mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +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)
|
if (!CI)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Value *LHS = CI->getOperand(0);
|
|
||||||
Value *RHS = CI->getOperand(1);
|
Value *RHS = CI->getOperand(1);
|
||||||
|
ConstantInt *CV = dyn_cast<ConstantInt>(RHS);
|
||||||
bool hasZero = false;
|
if (!CV || !CV->isZero())
|
||||||
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)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool isProb;
|
bool isProb;
|
||||||
@ -321,11 +309,9 @@ bool BranchProbabilityAnalysis::calcZeroHeuristics(BasicBlock *BB) {
|
|||||||
case CmpInst::ICMP_SLT:
|
case CmpInst::ICMP_SLT:
|
||||||
case CmpInst::ICMP_SLE:
|
case CmpInst::ICMP_SLE:
|
||||||
// Less or equal to zero is not expected.
|
// Less or equal to zero is not expected.
|
||||||
// 0 < X -> isProb = true
|
// X < 0 -> Unlikely
|
||||||
// 0 <= X -> isProb = true
|
// X <= 0 -> Unlikely
|
||||||
// X < 0 -> isProb = false
|
isProb = false;
|
||||||
// X <= 0 -> isProb = false
|
|
||||||
isProb = lhsZero;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CmpInst::ICMP_UGT:
|
case CmpInst::ICMP_UGT:
|
||||||
@ -333,11 +319,9 @@ bool BranchProbabilityAnalysis::calcZeroHeuristics(BasicBlock *BB) {
|
|||||||
case CmpInst::ICMP_SGT:
|
case CmpInst::ICMP_SGT:
|
||||||
case CmpInst::ICMP_SGE:
|
case CmpInst::ICMP_SGE:
|
||||||
// Greater or equal to zero is expected.
|
// Greater or equal to zero is expected.
|
||||||
// 0 > X -> isProb = false
|
// X > 0 -> Likely
|
||||||
// 0 >= X -> isProb = false
|
// X >= 0 -> Likely
|
||||||
// X > 0 -> isProb = true
|
isProb = true;
|
||||||
// X >= 0 -> isProb = true
|
|
||||||
isProb = !lhsZero;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user