mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
reversed the logic of the log2 detection routine to reduce the number of nested ifs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d6964741f5
commit
ef2ef3e246
@ -261,31 +261,35 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2) {
|
static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2) {
|
||||||
if (Op->hasOneUse()) {
|
|
||||||
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op)) {
|
if (!Op->hasOneUse())
|
||||||
if (II->getIntrinsicID() == Intrinsic::log2 &&
|
return;
|
||||||
II->hasUnsafeAlgebra()) {
|
|
||||||
Log2 = II;
|
IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op);
|
||||||
Value *OpLog2Of = II->getArgOperand(0);
|
if (!II)
|
||||||
if (OpLog2Of->hasOneUse()) {
|
return;
|
||||||
if (Instruction *I = dyn_cast<Instruction>(OpLog2Of)) {
|
if (II->getIntrinsicID() != Intrinsic::log2 || !II->hasUnsafeAlgebra())
|
||||||
if (I->getOpcode() == Instruction::FMul &&
|
return;
|
||||||
I->hasUnsafeAlgebra()) {
|
Log2 = II;
|
||||||
ConstantFP *CFP = dyn_cast<ConstantFP>(I->getOperand(0));
|
|
||||||
if (CFP && CFP->isExactlyValue(0.5)) {
|
Value *OpLog2Of = II->getArgOperand(0);
|
||||||
Y = I->getOperand(1);
|
if (!OpLog2Of->hasOneUse())
|
||||||
} else {
|
return;
|
||||||
CFP = dyn_cast<ConstantFP>(I->getOperand(1));
|
|
||||||
if (CFP && CFP->isExactlyValue(0.5)) {
|
Instruction *I = dyn_cast<Instruction>(OpLog2Of);
|
||||||
Y = I->getOperand(0);
|
if (!I)
|
||||||
}
|
return;
|
||||||
}
|
if (I->getOpcode() != Instruction::FMul || !I->hasUnsafeAlgebra())
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
}
|
ConstantFP *CFP = dyn_cast<ConstantFP>(I->getOperand(0));
|
||||||
}
|
if (CFP && CFP->isExactlyValue(0.5)) {
|
||||||
}
|
Y = I->getOperand(1);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
CFP = dyn_cast<ConstantFP>(I->getOperand(1));
|
||||||
|
if (CFP && CFP->isExactlyValue(0.5))
|
||||||
|
Y = I->getOperand(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
|
Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user