mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-02 01:47:06 +00:00
add an instcombine xform. This speeds up 462.libquantum from 9.78s to
7.48s. This regression is due to unforseen consequences of the cast patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67a821d9a3
commit
e13ab2a9a1
@ -6023,6 +6023,23 @@ Instruction *InstCombiner::visitTrunc(CastInst &CI) {
|
||||
Value *V = InsertCastBefore(SrcI->getOperand(0), Ty, CI);
|
||||
return new ShiftInst(Instruction::LShr, V, SrcI->getOperand(1));
|
||||
}
|
||||
} else { // This is a variable shr.
|
||||
|
||||
// Turn 'trunc (lshr X, Y) to bool' into '(X & (1 << Y)) != 0'. This is
|
||||
// more LLVM instructions, but allows '1 << Y' to be hoisted if
|
||||
// loop-invariant and CSE'd.
|
||||
if (CI.getType() == Type::BoolTy && SrcI->hasOneUse()) {
|
||||
Value *One = ConstantInt::get(SrcI->getType(), 1);
|
||||
|
||||
Value *V = InsertNewInstBefore(new ShiftInst(Instruction::Shl, One,
|
||||
SrcI->getOperand(1),
|
||||
"tmp"), CI);
|
||||
V = InsertNewInstBefore(BinaryOperator::createAnd(V,
|
||||
SrcI->getOperand(0),
|
||||
"tmp"), CI);
|
||||
Value *Zero = Constant::getNullValue(V->getType());
|
||||
return BinaryOperator::createSetNE(V, Zero);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user