HomePhabricator

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

Authored by malharJ on Fri, Apr 16, 8:45 AM.

Description

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

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/D97729.

Differential Revision: https://reviews.llvm.org/D100376