[PATCH] D27804: [SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 12:11:52 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289862: [SimplifyCFG] Merge debug locations when hoisting an instruction from a… (authored by adibiagio).

Changed prior to commit:
  https://reviews.llvm.org/D27804?vs=81567&id=81631#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27804

Files:
  llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp


Index: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -34,7 +34,7 @@
 #include "llvm/IR/ConstantRange.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
-#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
@@ -1276,10 +1276,10 @@
 
     // If the debug loc for I1 and I2 are different, as we are combining them
     // into one instruction, we do not want to select debug loc randomly from 
-    // I1 or I2. Instead, we set the 0-line DebugLoc to note that we do not
-    // know the debug loc of the hoisted instruction.
+    // I1 or I2.
     if (!isa<CallInst>(I1) &&  I1->getDebugLoc() != I2->getDebugLoc())
-      I1->setDebugLoc(DebugLoc());
+      I1->setDebugLoc(
+          DILocation::getMergedLocation(I1->getDebugLoc(), I2->getDebugLoc()));
  
     I2->eraseFromParent();
     Changed = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27804.81631.patch
Type: text/x-patch
Size: 1115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161215/3cf543f6/attachment.bin>


More information about the llvm-commits mailing list