[Early Machine LICM] Bad machine code: Virtual register killed in block, but needed live out.
| Bugzilla Link | 47483 |
| Version | trunk |
| OS | Linux |
| Attachments | reduced testcase |
| CC | @topperc,@JonPsson,@vedantk |
Extended Description
llc -mcpu=z13 -O3 tc_mver_vregkilled_neededliveout.ll -sink-insts-to-avoid-spills -verify-machineinstrs
*** Bad machine code: Virtual register killed in block, but needed live out. ***
- function: main
- basic block: %bb.3 bb5 (0x677c338) Virtual register %5 is used after the block. LLVM ERROR: Found 1 machine code errors.
An LLGCR instruction with a killed vreg %5 is moved into the loop without the kill flag being cleared...
This sinking code appears to be off by default so how can it be quite frequent?
I'm not sure I understand the code. The original commit message talks about sinking copy instructions, but the code seems to check that the users of the instruction being sunk are copies not the instruction itself.
Sorry - I meant that in random testing where this option sometimes is enabled I see this every week...
This sinking code appears to be off by default so how can it be quite frequent?
I'm not sure I understand the code. The original commit message talks about sinking copy instructions, but the code seems to check that the users of the instruction being sunk are copies not the instruction itself.
ping!
This is quite frequent with expensive checks enabled...
llc -mcpu=arch13 -O3 -consthoist-gep -sink-insts-to-avoid-spills -verify-machineinstrs tc_crash0_aftercreduce.ll
This is still here...
A little unhappy with the confusion about kill flags and their "trustworthiness". When working on transformations it would be helpful to have something more documented, rather than "maybe not trust" kill flags "late".
Ideally, either the verifier should not complain if it is actually acceptable (i.e. "kill flags are not guaranteed to be correct"), or the transformation should be fixed to not leave false kill flags.
Having liveness modelled correctly always (all actually killing uses marked as "kill") would be ideal but not practical if it is not really needed and difficult to compute. A first good step then I think would be to at least clear kill flags to conservatively omit them rather than ignoring them and leaving a false kill flag in the IR (which could theoretically be dangerous if that kill flag is "trusted").
I am not sure why this was assigned to me, was this a bug I created?
Probable solution: https://reviews.llvm.org/D126754
Thanks for the patch! Your name was the best one I could find and there was no "subscribe" button, so I had to assign it to you. I was assuming you would either try to fix it or assign somebody else...