summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-03-13 06:47:02 +0000
committerYonghong Song <yhs@fb.com>2018-03-13 06:47:02 +0000
commit905d13c1230685eb11b2a00b26773f5f052e80db (patch)
treea129820224a17d002c54bd5515eadeb7d7b1b517 /llvm/lib/Target/BPF
parent89e47ac67150ec2287db0d4541196d0a4d3f96cc (diff)
downloadbcm5719-llvm-905d13c1230685eb11b2a00b26773f5f052e80db.tar.gz
bcm5719-llvm-905d13c1230685eb11b2a00b26773f5f052e80db.zip
bpf: J*_RR should check both operands
There is a mistake in current code that we "break" out the optimization when the first operand of J*_RR doesn't qualify the elimination. This caused some elimination opportunities missed, for example the one in the testcase. The code should just fall through to handle the second operand. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 327366
Diffstat (limited to 'llvm/lib/Target/BPF')
-rw-r--r--llvm/lib/Target/BPF/BPFMIPeephole.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Target/BPF/BPFMIPeephole.cpp b/llvm/lib/Target/BPF/BPFMIPeephole.cpp
index 3df14b4ad5b..7d84b2834f8 100644
--- a/llvm/lib/Target/BPF/BPFMIPeephole.cpp
+++ b/llvm/lib/Target/BPF/BPFMIPeephole.cpp
@@ -156,12 +156,10 @@ bool BPFMIPeephole::eliminateCmpPromotionSeq(void) {
case BPF::JNE_rr:
Reg = MI.getOperand(1).getReg();
Mov = getInsnDefZExtSubReg(Reg);
- if (!Mov)
- break;
-
- updateInsnSeq(MBB, MI, Reg);
- Eliminated = true;
-
+ if (Mov) {
+ updateInsnSeq(MBB, MI, Reg);
+ Eliminated = true;
+ }
// Fallthrough
case BPF::JUGT_ri:
case BPF::JUGE_ri:
OpenPOWER on IntegriCloud