Sets insertion point of fake cond branch to the last phi node in the block
[oota-llvm.git] / lib / CodeGen / CodeGenPrepare.cpp
index df49c8d6aaeee372e4c32ac38054fcfb8855313e..ac8fbbf9c762fd7582809a43c1025b867b7e4051 100644 (file)
@@ -790,6 +790,9 @@ void TaintRelaxedLoads(Instruction* UsageInst) {
   // condition.
   auto* BB = UsageInst->getParent();
   auto* InsertPoint = UsageInst->getNextNode();
+  while (dyn_cast<PHINode>(InsertPoint)) {
+    InsertPoint = InsertPoint->getNextNode();
+  }
   IRBuilder<true, NoFolder> Builder(InsertPoint);
   // First thing is to cast 'UsageInst' to an integer type if necessary.
   Value* AndTarget = nullptr;