Make sure MTSPR instruction is inserted into the BasicBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14822 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PowerPCISelSimple.cpp b/lib/Target/PowerPC/PowerPCISelSimple.cpp
index c986ca4..10a19b5 100644
--- a/lib/Target/PowerPC/PowerPCISelSimple.cpp
+++ b/lib/Target/PowerPC/PowerPCISelSimple.cpp
@@ -1437,7 +1437,7 @@
TheCall = BuildMI(PPC32::CALLpcrel, 1).addGlobalAddress(F, true);
} else { // Emit an indirect call through the CTR
unsigned Reg = getReg(CI.getCalledValue());
- BuildMI(PPC32::MTSPR, 2).addZImm(9).addReg(Reg);
+ BuildMI(BB, PPC32::MTSPR, 2).addZImm(9).addReg(Reg);
TheCall = BuildMI(PPC32::CALLindirect, 1).addZImm(20).addZImm(0);
}