forked from OSchip/llvm-project
[GISel]: Allow PHIs to be DCEd
https://reviews.llvm.org/D53304 Currently dead phis are not cleaned up during DCE. This patch allows dead PHI and G_PHI insts to be deleted. Reviewed by: dsanders llvm-svn: 344811
This commit is contained in:
parent
80ed0fd6e0
commit
cd04e366d7
|
@ -137,7 +137,7 @@ bool llvm::isTriviallyDead(const MachineInstr &MI,
|
||||||
// If we can move an instruction, we can remove it. Otherwise, it has
|
// If we can move an instruction, we can remove it. Otherwise, it has
|
||||||
// a side-effect of some sort.
|
// a side-effect of some sort.
|
||||||
bool SawStore = false;
|
bool SawStore = false;
|
||||||
if (!MI.isSafeToMove(/*AA=*/nullptr, SawStore))
|
if (!MI.isSafeToMove(/*AA=*/nullptr, SawStore) && !MI.isPHI())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Instructions without side-effects are dead iff they only define dead vregs.
|
// Instructions without side-effects are dead iff they only define dead vregs.
|
||||||
|
|
|
@ -121,6 +121,7 @@ body: |
|
||||||
|
|
||||||
bb.3:
|
bb.3:
|
||||||
%9(s1) = G_PHI %5(s1), %bb.1, %8(s1), %bb.2
|
%9(s1) = G_PHI %5(s1), %bb.1, %8(s1), %bb.2
|
||||||
|
%11:_(s1) = G_PHI %5(s1), %bb.1, %8(s1), %bb.2
|
||||||
%10(s32) = G_ZEXT %9(s1)
|
%10(s32) = G_ZEXT %9(s1)
|
||||||
$w0 = COPY %10(s32)
|
$w0 = COPY %10(s32)
|
||||||
RET_ReallyLR implicit $w0
|
RET_ReallyLR implicit $w0
|
||||||
|
|
Loading…
Reference in New Issue