[PATCH] D68633: fix debug info affects output when opt inline

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 08:31:08 PDT 2019


aprantl requested changes to this revision.
aprantl added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1842-1843
 
+      // Debuginfo (@llvm.dbg.value) will make different result, skip while allocas scanning
+      while (isa<DbgInfoIntrinsic>(I)) ++I;
+
----------------
aprantl wrote:
> jmorse wrote:
> > Is there a possibility of an unrelated debug instruction being skipped here, and becoming part of the slice moved by lines 1847-1857? Moving dbg.values of arguments to the start of the caller may create a debug use-before-def situation, there could be other problem scenarios too.
> > 
> > Using a debug-instruction filtering iterator (like here [0]) might just do-the-right-thing, I don't know whether feeding one to splice would behave correctly though.
> > 
> > [0] https://github.com/llvm/llvm-project/blob/fdaa74217420729140f1786ea037ac445a724c8e/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L2592
> Don't we have an iterator that automatically skips debug intrinsics?
Please use BasicBlock::	instructionsWithoutDebug () instead of rolling your own.

https://llvm.org/doxygen/classllvm_1_1BasicBlock.html#aa696c5026c1241f4dd097f3558a43a47


================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1860
+        } else {
+          break;
+        }
----------------
llvm style would be to reverse the condition: break first, then unconditionally execute the code.


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

https://reviews.llvm.org/D68633





More information about the llvm-commits mailing list