Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/PowerPC/ppc64-acc-regalloc-bugfix.ll | ||
---|---|---|
4–7 | Please make adding -ppc-track-subreg-liveness another check-prefix. |
Accumulator prime and deprime instructions are quite expensive. The logic of this patch seems to be contrary to what we actually want. Namely, this will ensure that we don't remove redundant XXMTACC/XXMFACC pairs if some subregister of the associated accumulator is undefined (or defined in another basic block). If it is undefined, we don't care what its value is so it doesn't seem like a good idea to activate MMA simply because of such poorly written code.
Honestly, anything is likely better than keeping these - including simply defining the undefined register to all zeros using XXLXORz. But of course, we can't simply change this code to zero out the register in case it is actually defined in another block.
Would it be possible to delete the instructions just like we currently do and then use LivePhysRegs to eliminate any uses of dead registers? Basically, what I mean is that if any changes were made in this peephole, we do what is effectively dead instruction elimination as the last thing the peephole does on the entire function.
Doing so would turn the function in the test case into an empty one (which would be the correct thing to do here).
Do we plan to move forward @qiucf
Deleting the instruction seems can not work for all cases, for example, %r = and 0, undef, this is well defined.
IMO, can we just change the input case? For example, don't store undef(element 2) to memory, we can extract and store element 3, maybe? Storing undef should not be intended by the user and the machineverify failure can exactly tell the user there is something wrong in the source or in compiler optimizations?
Please make adding -ppc-track-subreg-liveness another check-prefix.