Skip to content

Commit 6588ac3

Browse files
authored
[MachineCombiner] Don't ignore PHI depths (llvm#82025)
The depths of the Root and the NewRoot are to be compared in MachineCombiner::improvesCriticalPathLen(), and while the call to BlockTrace.getInstrCycles(*Root) includes the Depth of a PHI, for some reason PHI nodes have been ignored in getOperandDef(). This patch removes the special handling of PHIs in getOperandDef() so that Root and NewRoot get a fair comparison. This does not affect loop headers as MachineTraceMetrics handles that case by ignoring incoming PHI edges.
1 parent 92a09c0 commit 6588ac3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

llvm/lib/CodeGen/MachineCombiner.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ MachineCombiner::getOperandDef(const MachineOperand &MO) {
155155
// We need a virtual register definition.
156156
if (MO.isReg() && MO.getReg().isVirtual())
157157
DefInstr = MRI->getUniqueVRegDef(MO.getReg());
158-
// PHI's have no depth etc.
159-
if (DefInstr && DefInstr->isPHI())
160-
DefInstr = nullptr;
161158
return DefInstr;
162159
}
163160

llvm/test/CodeGen/RISCV/umulo-128-legalisation-lowering.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ define { i128, i8 } @muloti_test(i128 %l, i128 %r) #0 {
8989
; RISCV32-NEXT: snez a3, a3
9090
; RISCV32-NEXT: and a3, a3, a7
9191
; RISCV32-NEXT: or a2, a3, a2
92-
; RISCV32-NEXT: or a3, t2, t3
93-
; RISCV32-NEXT: or a2, a2, a3
92+
; RISCV32-NEXT: or a2, a2, t2
93+
; RISCV32-NEXT: or a2, a2, t3
9494
; RISCV32-NEXT: mul a3, a5, a4
9595
; RISCV32-NEXT: andi a2, a2, 1
9696
; RISCV32-NEXT: sw a3, 0(a0)

llvm/test/CodeGen/X86/bitcast-and-setcc-256.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,8 @@ define i8 @v8i32_or_select(<8 x i32> %a0, <8 x i32> %a1, <8 x i32> %a2, <8 x i32
553553
; AVX1-NEXT: vpcmpeqd %xmm5, %xmm4, %xmm4
554554
; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
555555
; AVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
556-
; AVX1-NEXT: vorps %ymm2, %ymm3, %ymm1
557-
; AVX1-NEXT: vorps %ymm0, %ymm1, %ymm0
556+
; AVX1-NEXT: vorps %ymm0, %ymm3, %ymm0
557+
; AVX1-NEXT: vorps %ymm2, %ymm0, %ymm0
558558
; AVX1-NEXT: vmovmskps %ymm0, %eax
559559
; AVX1-NEXT: # kill: def $al killed $al killed $eax
560560
; AVX1-NEXT: vzeroupper
@@ -571,8 +571,8 @@ define i8 @v8i32_or_select(<8 x i32> %a0, <8 x i32> %a1, <8 x i32> %a2, <8 x i32
571571
; AVX2-NEXT: vpcmpeqd %ymm2, %ymm0, %ymm2
572572
; AVX2-NEXT: .LBB7_3:
573573
; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
574-
; AVX2-NEXT: vpor %ymm2, %ymm3, %ymm1
575-
; AVX2-NEXT: vpor %ymm0, %ymm1, %ymm0
574+
; AVX2-NEXT: vpor %ymm0, %ymm3, %ymm0
575+
; AVX2-NEXT: vpor %ymm2, %ymm0, %ymm0
576576
; AVX2-NEXT: vmovmskps %ymm0, %eax
577577
; AVX2-NEXT: # kill: def $al killed $al killed $eax
578578
; AVX2-NEXT: vzeroupper

0 commit comments

Comments
 (0)