[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
clattner at apple.com
Sun Mar 25 13:29:45 PDT 2007
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.688
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.689
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.688 Sun
> Mar 25 00:33:51 2007
> +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Mar 25
> 14:55:33 2007
> @@ -540,9 +540,8 @@
> if (I->getOpcode() == Instruction::Shl)
> if ((CST = dyn_cast<ConstantInt>(I->getOperand(1)))) {
> // The multiplier is really 1 << CST.
> - APInt Multiplier(V->getType()->getPrimitiveSizeInBits(),
> 0);
> - Multiplier.set(CST->getZExtValue()); // set bit is == 1
> << CST
> - CST = ConstantInt::get(Multiplier);
> + Constant *One = ConstantInt::get(V->getType(), 1);
> + CST = cast<ConstantInt>(ConstantExpr::getShl(One, CST));
This is doing arithmetic with constant expr :(. Why not something like:
ConstantInt::get(APInt(bitwidth, 1).shl(CST->getValue()))
or something?
-Chris
More information about the llvm-commits
mailing list