New binops need debug loc.
authorDevang Patel <dpatel@apple.com>
Wed, 22 Jun 2011 20:56:56 +0000 (20:56 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 22 Jun 2011 20:56:56 +0000 (20:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolutionExpander.cpp

index 8e5a40008d88090914ac79b0cc8b3b4d56eb7fa1..054993532835c9792e8e96ebb57dfb01ab8d3478 100644 (file)
@@ -159,7 +159,8 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode,
   }
 
   // If we haven't found this binop, insert it.
-  Value *BO = Builder.CreateBinOp(Opcode, LHS, RHS, "tmp");
+  Instruction *BO = cast<Instruction>(Builder.CreateBinOp(Opcode, LHS, RHS, "tmp"));
+  BO->setDebugLoc(SaveInsertPt->getDebugLoc());
   rememberInstruction(BO);
 
   // Restore the original insert point.
@@ -1155,6 +1156,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
         Instruction *Add = BinaryOperator::CreateAdd(CanonicalIV, One,
                                                      "indvar.next",
                                                      HP->getTerminator());
+        Add->setDebugLoc(HP->getTerminator()->getDebugLoc());
         rememberInstruction(Add);
         CanonicalIV->addIncoming(Add, HP);
       } else {