[PATCH] Fixing line numbers of inlined allocas

David Blaikie dblaikie at gmail.com
Fri Oct 17 10:12:15 PDT 2014


================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:813
@@ -812,1 +812,3 @@
          BI != BE; ++BI) {
+      // Don't update static allocas, as they may get moved later.
+      if (isa<AllocaInst>(BI) &&
----------------
To avoid isa + cast, we'd probably write this as:

  if (auto *AI = dyn_cast<AllocaInst>(BI))
    if (isa<Constant>(AI->getArraySize()))
      continue;

Also, given that static allocas are so special, is there not a more direct way to test for them than isa<Constant> on the array size?

================
Comment at: test/DebugInfo/debug-info-always-inline.ll:7
@@ +6,3 @@
+; /* BEGIN SOURCE */
+; int __attribute__((always_inline)) foo()
+; {
----------------
Should we add nodebug to this function just to demonstrate why the other solutions we discussed were insufficient? (eg: we can't describe it as inlining, etc)

One day we might want to describe it as inlining in the non-nodebug case (and update the prologue handling code to cope with this), but we'd still need to do this for nodebug.

Or test both & describe that one /could/ change but mention the prologue complications.

Or just write a comment describing the gotchas here.

http://reviews.llvm.org/D5401






More information about the llvm-commits mailing list