[PATCH] D30701: [LoopRotate] Fix for dbg.value propagation

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:06:09 PST 2017


samparker created this revision.
Herald added a subscriber: mzolotukhin.

The patch of https://reviews.llvm.org/D30190 was reverted  in r297159. This patch should address the bug raised in https://bugs.llvm.org/show_bug.cgi?id=32171 as well as a similar issue that Adrian had pointed out, but I missed, in the previous review.


https://reviews.llvm.org/D30701

Files:
  lib/Transforms/Scalar/LoopRotation.cpp


Index: lib/Transforms/Scalar/LoopRotation.cpp
===================================================================
--- lib/Transforms/Scalar/LoopRotation.cpp
+++ lib/Transforms/Scalar/LoopRotation.cpp
@@ -183,8 +183,8 @@
   // Map existing PHI nodes to their dbg.values.
   for (auto &I : *OrigHeader) {
     if (auto DbgII = dyn_cast<DbgInfoIntrinsic>(&I)) {
-      if (isa<PHINode>(DbgII->getVariableLocation()))
-        DbgValueMap.insert({DbgII->getVariableLocation(), DbgII});
+      if (auto Loc = dyn_cast<PHINode>(DbgII->getVariableLocation()))
+        DbgValueMap.insert({Loc, DbgII});
     }
   }
 
@@ -196,7 +196,7 @@
     for (auto VI : PHI->operand_values()) {
       auto V = DbgValueMap.find(VI);
       if (V != DbgValueMap.end()) {
-        auto *DbgII = dyn_cast<DbgInfoIntrinsic>(V->second);
+        auto *DbgII = cast<DbgInfoIntrinsic>(V->second);
         Instruction *NewDbgII = DbgII->clone();
         auto PhiMAV = MetadataAsValue::get(C, ValueAsMetadata::get(PHI));
         NewDbgII->setOperand(0, PhiMAV);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30701.90872.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/e9a11567/attachment.bin>


More information about the llvm-commits mailing list