[PATCH] D73630: [InstCombine][DebugInfo] Fold constants wrapped in metadata

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 09:12:34 PST 2020


vsk accepted this revision.
vsk added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:3570
+            V = VAM->getValue();
+            WrapAsMetadata = true;
+          }
----------------
I think this is the right way to implement this change at the moment. If a similar need comes up in other contexts, we might consider adding a helper API to Use e.g. `std::pair<Value *, bool /* IsMetadataAsValue */> Use::getUnderlyingValue()`.


================
Comment at: llvm/test/Transforms/InstCombine/constant-fold-metadata-wrapped.ll:15
+; CHECK: call void @llvm.dbg.value(metadata i32* getelementptr inbounds (%struct.Foo, %struct.Foo* @global, i64 0, i32 0)
+; CHECK: call void @ext(i32* getelementptr inbounds (%struct.Foo, %struct.Foo* @global, i64 0, i32 0))
+
----------------
Could you mention that the constant fold here is to turn an i32 GEP operand into i64? It's slightly tricky to spot.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73630/new/

https://reviews.llvm.org/D73630





More information about the llvm-commits mailing list