From 905d13c1230685eb11b2a00b26773f5f052e80db Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Tue, 13 Mar 2018 06:47:02 +0000 Subject: 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 Signed-off-by: Yonghong Song llvm-svn: 327366 --- llvm/lib/Target/BPF/BPFMIPeephole.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Target/BPF') 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: -- cgit v1.2.3