This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Prevent phi-node-elimination from generating copy above t2WhileLoopStartLR
ClosedPublic

Authored by malharJ on Apr 13 2021, 3:32 AM.

Details

Summary

This patch prevents phi-node-elimination from generating a COPY operation for the register
defined by t2WhileLoopStartLR, as it is a terminator that defines a value.

This happens because of the presence of phi-nodes in the loop body (the Preheader
of which is the block containing the t2WhileLoopStartLR). If this is not done,
the COPY is generated above/before the terminator (t2WhileLoopStartLR here),
and since it uses the value defined by t2WhileLoopStartLR, MachineVerifier throws
a 'use before define' error.

This essentially adds on to the change in differential D91887

Diff Detail

Event Timeline

malharJ created this revision.Apr 13 2021, 3:32 AM
malharJ requested review of this revision.Apr 13 2021, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 3:32 AM
dmgreen added inline comments.Apr 14 2021, 1:02 AM
llvm/test/CodeGen/Thumb2/phi_prevent_copy.mir
3

Don't need to add -O1, or a cpu. You can use -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve

26

Is this and the stuff below needed?

malharJ updated this revision to Diff 337634.Apr 14 2021, 10:26 PM

Simplified the test file.

dmgreen accepted this revision.Apr 14 2021, 11:56 PM

Thanks. LGTM

This revision is now accepted and ready to land.Apr 14 2021, 11:56 PM