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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:19:10 PST 2017


aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Inline comments, otherwise looks ok.



================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:185
   for (auto &I : *OrigHeader) {
     if (auto DbgII = dyn_cast<DbgInfoIntrinsic>(&I)) {
+      if (auto Loc = dyn_cast<PHINode>(DbgII->getVariableLocation()))
----------------
`auto *`


================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:186
     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});
----------------
I think you still want a dyn_cast_or_null here. Optimizations sometimes delete an llvm::Value without deleting debug intrinsics pointing to it.


================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:189
     }
   }
 
----------------
You could get rid of all curly braces here if you want to.


https://reviews.llvm.org/D30701





More information about the llvm-commits mailing list