[PATCH] D19564: Update Debug Intrinsics in RewriteUsesOfClonedInstructions in LoopRotation

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 11:10:42 PDT 2016


aprantl added inline comments.

================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:114
@@ +113,3 @@
+    // Replace MetadataAsValue(ValueAsMetadata(OrigHeaderVal)) uses in debug
+    // intrinsics
+    LLVMContext &C = OrigHeader->getContext();
----------------
Missing a '.'

================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:116
@@ +115,3 @@
+    LLVMContext &C = OrigHeader->getContext();
+    if (ValueAsMetadata *VAM = ValueAsMetadata::getIfExists(OrigHeaderVal)) {
+      if (MetadataAsValue *MAV = MetadataAsValue::getIfExists(C, VAM)) {
----------------
could use auto here, the type is obvious from context.

================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:120
@@ +119,3 @@
+          // Grab the use before incrementing the iterator.
+          Use &U = *UI++;
+          DbgInfoIntrinsic *UserInst = cast<DbgInfoIntrinsic>(U.getUser());
----------------
Could this be written as a range-based for?

================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:121
@@ +120,3 @@
+          Use &U = *UI++;
+          DbgInfoIntrinsic *UserInst = cast<DbgInfoIntrinsic>(U.getUser());
+          BasicBlock *UserBB = UserInst->getParent();
----------------
Isn't this dangerous; could there be other metadata uses (TBAA, etc)? Should we use a dyn_cast here?


http://reviews.llvm.org/D19564





More information about the llvm-commits mailing list