[llvm] r267294 - Revert "[AArch64] Fix optimizeCondBranch logic."

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 23 12:30:52 PDT 2016


Author: rengolin
Date: Sat Apr 23 14:30:52 2016
New Revision: 267294

URL: http://llvm.org/viewvc/llvm-project?rev=267294&view=rev
Log:
Revert "[AArch64] Fix optimizeCondBranch logic."

This reverts commit r267206, as it broke self-hosting on AArch64.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
    llvm/trunk/test/CodeGen/AArch64/aarch64-tbz.ll

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=267294&r1=267293&r2=267294&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Sat Apr 23 14:30:52 2016
@@ -3353,9 +3353,9 @@ bool AArch64InstrInfo::optimizeCondBranc
     if (!MRI->hasOneNonDBGUse(VReg))
       return false;
 
-    bool Is64Bit = DefMI->getOpcode() != AArch64::ANDWri;
     uint64_t Mask = AArch64_AM::decodeLogicalImmediate(
-        DefMI->getOperand(2).getImm(), Is64Bit ? 64 : 32);
+        DefMI->getOperand(2).getImm(),
+        (DefMI->getOpcode() == AArch64::ANDWri) ? 32 : 64);
     if (!isPowerOf2_64(Mask))
       return false;
 
@@ -3370,9 +3370,9 @@ bool AArch64InstrInfo::optimizeCondBranc
     MachineBasicBlock *TBB = MI->getOperand(1).getMBB();
     DebugLoc DL = MI->getDebugLoc();
     unsigned Imm = Log2_64(Mask);
-    unsigned Opc = Is64Bit
-                       ? (IsNegativeBranch ? AArch64::TBNZX : AArch64::TBZX)
-                       : (IsNegativeBranch ? AArch64::TBNZW : AArch64::TBZW);
+    unsigned Opc = (Imm < 32)
+                       ? (IsNegativeBranch ? AArch64::TBNZW : AArch64::TBZW)
+                       : (IsNegativeBranch ? AArch64::TBNZX : AArch64::TBZX);
     BuildMI(RefToMBB, MI, DL, get(Opc)).addReg(NewReg).addImm(Imm).addMBB(TBB);
     MI->eraseFromParent();
     return true;

Modified: llvm/trunk/test/CodeGen/AArch64/aarch64-tbz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/aarch64-tbz.ll?rev=267294&r1=267293&r2=267294&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/aarch64-tbz.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/aarch64-tbz.ll Sat Apr 23 14:30:52 2016
@@ -1,4 +1,4 @@
-; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnueabi < %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-linux-gnueabi < %s | FileCheck %s
 
 ; CHECK-LABEL: test1
 ; CHECK: tbz {{w[0-9]}}, #3, {{.LBB0_3}}




More information about the llvm-commits mailing list