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

Chris Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 04:09:10 PDT 2019


yechunliang marked an inline comment as done.
yechunliang added a comment.

> So the root cause is rather that we treat an alloca being immediately preceeded by another alloca differrently from the case when it is preceeded by another kind of instruction. This happens also when having other instructions in between, and is not specific to dbg intrinsics (could be interesting to add a test case where you replace the dbg intrinsics by something else).

Yes I think so, if the other instruction is not dbg instr which exist between two allocas, the InlineFunction with and without "-strip-debug" will make the same behavior, that should both erase second use_empty alloca. This patch is to fix the issue that debug instr impact InlineFunction generate different output.

> So I think that the solution might be based on one of these ideas:
> 
> 1. Remove the check for use_empty in the outer loop.
> 2. Add a check for !use_empty in the inner loop.
> 3. Remove the inner loop (i.e only splice one alloca at a time).

These good ideas should be talking about the design change of alloca inline or improvement of splice.  
Read from the code, I think about the alloca inline behavior like this: First detect one !use_empty alloca,  if next immediate instructions are allocas, even they are use_empty, they will all added one after one and move to caller together with first alloca. if other instruction (whatever dbg or others instrs) exist between allocas, the next alloca will check if is use_empty or not, if is use_empty then erase. Does this behavior correct, or could be improve? I don't know much about alloca inline. but seems the code run many years with this design.


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

https://reviews.llvm.org/D68633





More information about the llvm-commits mailing list