Skip to content

Commit ca26039

Browse files
author
Chen Zheng
committedJan 30, 2019
[PowerPC] more opportunity for converting reg+reg to reg+imm
Differential Revision: https://reviews.llvm.org/D57314 llvm-svn: 352583
1 parent 4a4d7a7 commit ca26039

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
 

‎llvm/lib/Target/PowerPC/PPCInstrInfo.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3205,9 +3205,9 @@ bool PPCInstrInfo::isRegElgibleForForwarding(const MachineOperand &RegMO,
32053205
}
32063206
assert((&*It) == &DefMI && "DefMI is missing");
32073207

3208-
// If DefMI also uses the register to be forwarded, we can only forward it
3208+
// If DefMI also defines the register to be forwarded, we can only forward it
32093209
// if DefMI is being erased.
3210-
if (DefMI.readsRegister(Reg, &getRegisterInfo()))
3210+
if (DefMI.modifiesRegister(Reg, &getRegisterInfo()))
32113211
return KillDefMI;
32123212

32133213
return true;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# RUN: llc -mtriple=powerpc64le--linux-gnu -stop-after ppc-pre-emit-peephole %s -o - -verify-machineinstrs | FileCheck %s
2+
3+
---
4+
# ADDI8 + STFSX can be converted to ADDI8 + STFS even ADDI8 can not be erased.
5+
name: testFwdOperandKilledAfter
6+
# CHECK: name: testFwdOperandKilledAfter
7+
tracksRegLiveness: true
8+
body: |
9+
bb.0.entry:
10+
liveins: $x3, $f1, $x5
11+
$x3 = ADDI8 $x5, 100
12+
STFSX killed $f1, $zero8, $x3
13+
; CHECK: STFS killed $f1, 100, $x5
14+
STD killed $x3, killed $x5, 100
15+
; CHECK: STD killed $x3, killed $x5, 100
16+
BLR8 implicit $lr8, implicit $rm
17+
...

0 commit comments

Comments
 (0)
Please sign in to comment.