mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Do not handle case where LHS is equal to zero, because InstCombiner always moves
it to RHS anyway. llvm-svn: 136586
This commit is contained in:
parent
92b7e5d6e5
commit
6795c54cb7
@ -287,21 +287,9 @@ bool BranchProbabilityAnalysis::calcZeroHeuristics(BasicBlock *BB) {
|
||||
if (!CI)
|
||||
return false;
|
||||
|
||||
Value *LHS = CI->getOperand(0);
|
||||
Value *RHS = CI->getOperand(1);
|
||||
|
||||
bool hasZero = false;
|
||||
bool lhsZero = false;
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(LHS)) {
|
||||
hasZero = CI->isZero();
|
||||
lhsZero = true;
|
||||
}
|
||||
|
||||
if (!hasZero)
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(RHS))
|
||||
hasZero = CI->isZero();
|
||||
|
||||
if (!hasZero)
|
||||
ConstantInt *CV = dyn_cast<ConstantInt>(RHS);
|
||||
if (!CV || !CV->isZero())
|
||||
return false;
|
||||
|
||||
bool isProb;
|
||||
@ -321,11 +309,9 @@ bool BranchProbabilityAnalysis::calcZeroHeuristics(BasicBlock *BB) {
|
||||
case CmpInst::ICMP_SLT:
|
||||
case CmpInst::ICMP_SLE:
|
||||
// Less or equal to zero is not expected.
|
||||
// 0 < X -> isProb = true
|
||||
// 0 <= X -> isProb = true
|
||||
// X < 0 -> isProb = false
|
||||
// X <= 0 -> isProb = false
|
||||
isProb = lhsZero;
|
||||
// X < 0 -> Unlikely
|
||||
// X <= 0 -> Unlikely
|
||||
isProb = false;
|
||||
break;
|
||||
|
||||
case CmpInst::ICMP_UGT:
|
||||
@ -333,11 +319,9 @@ bool BranchProbabilityAnalysis::calcZeroHeuristics(BasicBlock *BB) {
|
||||
case CmpInst::ICMP_SGT:
|
||||
case CmpInst::ICMP_SGE:
|
||||
// Greater or equal to zero is expected.
|
||||
// 0 > X -> isProb = false
|
||||
// 0 >= X -> isProb = false
|
||||
// X > 0 -> isProb = true
|
||||
// X >= 0 -> isProb = true
|
||||
isProb = !lhsZero;
|
||||
// X > 0 -> Likely
|
||||
// X >= 0 -> Likely
|
||||
isProb = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user