From 091be7b530a80e269183d98b41f393016e33af82 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 14 Apr 2015 15:56:33 +0000 Subject: [PATCH] Revert "The code that originally made me discover this is:" This reverts commit r234898. CodeGen/ARM/2013-10-11-select-stalls.ll was faling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234903 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/BranchProbabilityInfo.cpp | 8 ------ test/Analysis/BranchProbabilityInfo/basic.ll | 28 -------------------- test/CodeGen/AArch64/arm64-call-tailcalls.ll | 2 +- test/CodeGen/Mips/octeon.ll | 4 +-- 4 files changed, 3 insertions(+), 39 deletions(-) diff --git a/lib/Analysis/BranchProbabilityInfo.cpp b/lib/Analysis/BranchProbabilityInfo.cpp index d7cee3afaf5..14800f4a28b 100644 --- a/lib/Analysis/BranchProbabilityInfo.cpp +++ b/lib/Analysis/BranchProbabilityInfo.cpp @@ -379,14 +379,6 @@ bool BranchProbabilityInfo::calcZeroHeuristics(BasicBlock *BB) { if (!CV) return false; - // If the LHS is the result of AND'ing a value with a single bit bitmask, - // we don't have information about probabilities. - if (Instruction *LHS = dyn_cast(CI->getOperand(0))) - if (LHS->getOpcode() == Instruction::And) - if (ConstantInt *AndRHS = dyn_cast(LHS->getOperand(1))) - if (AndRHS->getUniqueInteger().isPowerOf2()) - return false; - bool isProb; if (CV->isZero()) { switch (CI->getPredicate()) { diff --git a/test/Analysis/BranchProbabilityInfo/basic.ll b/test/Analysis/BranchProbabilityInfo/basic.ll index 2c9c1561868..0f669119bfe 100644 --- a/test/Analysis/BranchProbabilityInfo/basic.ll +++ b/test/Analysis/BranchProbabilityInfo/basic.ll @@ -212,31 +212,3 @@ exit: ret i32 %result } -define i32 @zero3(i32 %i, i32 %a, i32 %b) { -; CHECK: Printing analysis {{.*}} for function 'zero3' -entry: -; AND'ing with a single bit bitmask essentially leads to a bool comparison, -; meaning we don't have probability information. - %and = and i32 %i, 2 - %tobool = icmp eq i32 %and, 0 - br i1 %tobool, label %then, label %else -; CHECK: edge entry -> then probability is 16 / 32 -; CHECK: edge entry -> else probability is 16 / 32 - -then: -; AND'ing with other bitmask might be something else, so we still assume the -; usual probabilities. - %and2 = and i32 %i, 5 - %tobool2 = icmp eq i32 %and2, 0 - br i1 %tobool2, label %else, label %exit -; CHECK: edge then -> else probability is 12 / 32 -; CHECK: edge then -> exit probability is 20 / 32 - -else: - br label %exit - -exit: - %result = phi i32 [ %a, %then ], [ %b, %else ] - ret i32 %result -} - diff --git a/test/CodeGen/AArch64/arm64-call-tailcalls.ll b/test/CodeGen/AArch64/arm64-call-tailcalls.ll index 6621db25da5..71d932787ce 100644 --- a/test/CodeGen/AArch64/arm64-call-tailcalls.ll +++ b/test/CodeGen/AArch64/arm64-call-tailcalls.ll @@ -53,9 +53,9 @@ bb: ; preds = %entry define i32 @t8(i32 %x) nounwind ssp { ; CHECK-LABEL: t8: -; CHECK: b _c ; CHECK: b _a ; CHECK: b _b +; CHECK: b _c %and = and i32 %x, 1 %tobool = icmp eq i32 %and, 0 br i1 %tobool, label %if.end, label %if.then diff --git a/test/CodeGen/Mips/octeon.ll b/test/CodeGen/Mips/octeon.ll index 499ce3c1ddb..97e12e721f5 100644 --- a/test/CodeGen/Mips/octeon.ll +++ b/test/CodeGen/Mips/octeon.ll @@ -93,7 +93,7 @@ entry: ; ALL-LABEL: bbit0: ; OCTEON: bbit0 $4, 3, $[[BB0:BB[0-9_]+]] ; MIPS64: andi $[[T0:[0-9]+]], $4, 8 -; MIPS64: bnez $[[T0]], $[[BB0:BB[0-9_]+]] +; MIPS64: beqz $[[T0]], $[[BB0:BB[0-9_]+]] %bit = and i64 %a, 8 %res = icmp eq i64 %bit, 0 br i1 %res, label %endif, label %if @@ -111,7 +111,7 @@ entry: ; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 1 ; MIPS64: dsll $[[T1:[0-9]+]], $[[T0]], 35 ; MIPS64: and $[[T2:[0-9]+]], $4, $[[T1]] -; MIPS64: bnez $[[T2]], $[[BB0:BB[0-9_]+]] +; MIPS64: beqz $[[T2]], $[[BB0:BB[0-9_]+]] %bit = and i64 %a, 34359738368 %res = icmp eq i64 %bit, 0 br i1 %res, label %endif, label %if -- 2.34.1