[PATCH] D40042: [InstCombine] Replace metadata alloca uses without a cast

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 11:28:32 PST 2017


rnk added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:150
+  // soon.
+  if (ValueAsMetadata *MDUse = ValueAsMetadata::getIfExists(&AI)) {
+    LLVMContext &Ctx = New->getContext();
----------------
aprantl wrote:
> are there metadata users besides debug info? Would findDbgValues() be more readable?
I can't think of any non-debug info uses. I did it this way because I wanted it to handle dbg.value, dbg.declare, and dbg.addr uniformly. This matter in situations where the value of a variable is the address of a variable (my favorite test case):
  struct Foo PromoteMe = *p;
  struct Foo *addr = &PromoteMe; // dbg.value(&PromoteMe)

An alternative way of looking at this bug is that it is a failure of salvageDebugInfo to handle dbg.declare. Actually, I wonder if I can update its use of findDbgValues to use this pattern and see if that fixes the bug more generally.


https://reviews.llvm.org/D40042





More information about the llvm-commits mailing list