>
> Fix PR1499: http://llvm.org/PR1499 .
Very nice, thanks again Lauro!
-Chris
>
> ---
> Diffs of the changes: (+4 -0)
>
> InstructionCombining.cpp |4
> 1 files changed, 4 insertions(+)
>
>
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Sca
On Apr 27, 2007, at 8:44 PM, Nick Lewycky wrote:
> Chris Lattner wrote:
>> + if (OrigBase) {
>> +// If we were able to index down into an element,
>> create the GEP
>> +// and bitcast the result. This eliminates one
>> bitcast, potentially
>> +//
Chris Lattner wrote:
> + if (OrigBase) {
> +// If we were able to index down into an element, create the GEP
> +// and bitcast the result. This eliminates one bitcast,
> potentially
> +// two.
> +Instruction *NGEP = new GetElementPtrInst(Or
> Reverting back to 1.723. The last two commits broke JM (and possibily others)
> on ARM.
Definitely. Qt is broken too. Funny, but I see exactly the same errors,
as soon after Reid's InstCombine APIntifiaction (some bits are missing,
so tool outputs "settitle" instead of "setTitle" :) ). Will inve
> Use APInt operators to calculate the carry bits, remove this loop.
Nice :)
-Chris
>
>
> ---
> Diffs of the changes: (+2 -16)
>
> InstructionCombining.cpp | 18 ++
> 1 files changed, 2 insertions(+), 16 deletions(-)
>
>
> Index: llvm/lib/Transforms/Scalar/InstructionCombinin
在 2007-03-29四的 23:20 -0700,Reid Spencer写道:
> On Thu, 2007-03-29 at 23:08 -0700, Chris Lattner wrote:
> > On Mar 28, 2007, at 6:57 PM, Zhou Sheng wrote:
> >
> > > @@ -540,8 +540,10 @@
> > >if (I->getOpcode() == Instruction::Shl)
> > > if ((CST = dyn_cast(I->getOperand(1 {
> > >
On Mar 28, 2007, at 7:26 PM, Zhou Sheng wrote:
> InstructionCombining.cpp updated: 1.706 -> 1.707
> ---
> Log message:
>
> Clean up codes in InstCombiner::SimplifyDemandedBits():
> 1. Line out nested call of APInt::zext/trunc.
> 2. Make more use of APInt::getHighBitsSet/getLowBitsSet.
> 3. Use AP
On Thu, 2007-03-29 at 23:08 -0700, Chris Lattner wrote:
> On Mar 28, 2007, at 6:57 PM, Zhou Sheng wrote:
>
> > @@ -540,8 +540,10 @@
> >if (I->getOpcode() == Instruction::Shl)
> > if ((CST = dyn_cast(I->getOperand(1 {
> >// The multiplier is really 1 << CST.
> > -
On Mar 28, 2007, at 6:57 PM, Zhou Sheng wrote:
> @@ -540,8 +540,10 @@
>if (I->getOpcode() == Instruction::Shl)
> if ((CST = dyn_cast(I->getOperand(1 {
>// The multiplier is really 1 << CST.
> - Constant *One = ConstantInt::get(V->getType(), 1);
> -
On Wed, 2007-03-28 at 14:23 +0800, Zhou Sheng wrote:
> 在 2007-03-27二的 22:17 -0700,Reid Spencer写道:
> > > >KnownOne |= NewBits;
> > > > - KnownZero &= ~NewBits;
> > > > -} else { // Input sign bit unknown
> > > > - KnownZero &= ~NewBits;
> > > > -
在 2007-03-27二的 22:17 -0700,Reid Spencer写道:
> Sheng,
>
> A correction to my last email ..
>
> On Tue, 2007-03-27 at 22:13 -0700, Reid Spencer wrote:
> > > // If the sign bit of the input is known set or clear, then we know
> > > the
> > > // top bits of the result.
> > > -APInt InS
Sheng,
A correction to my last email ..
On Tue, 2007-03-27 at 22:13 -0700, Reid Spencer wrote:
> > // If the sign bit of the input is known set or clear, then we know the
> > // top bits of the result.
> > -APInt InSignBit(APInt::getSignBit(SrcTy->getBitWidth()));
> > -InSignBi
Sheng,
Some important feedback ..
Reid.
On Tue, 2007-03-27 at 21:19 -0500, Zhou Sheng wrote:
>
> Changes in directory llvm/lib/Transforms/Scalar:
>
> InstructionCombining.cpp updated: 1.699 -> 1.700
> ---
> Log message:
>
> Clean up codes in ComputeMaskedBits():
> 1. Line out nested use of ze
On Mar 26, 2007, at 11:33 AM, Reid Spencer wrote:
> On Mon, 2007-03-26 at 11:29 -0700, Chris Lattner wrote:
>>> @@ -57,6 +57,9 @@
>>> #include "llvm/ADT/STLExtras.h"
>>> #include
>>> #include
>>> +#ifndef NDEBUG
>>> +#include
>>> +#endif
>>
>> Please don't conditionally #include files.
>
>
On Mon, 2007-03-26 at 11:29 -0700, Chris Lattner wrote:
> > @@ -57,6 +57,9 @@
> > #include "llvm/ADT/STLExtras.h"
> > #include
> > #include
> > +#ifndef NDEBUG
> > +#include
> > +#endif
>
> Please don't conditionally #include files.
Why? You would get sstream #included in a release build wh
> @@ -57,6 +57,9 @@
> #include "llvm/ADT/STLExtras.h"
> #include
> #include
> +#ifndef NDEBUG
> +#include
> +#endif
Please don't conditionally #include files.
Thanks for the patch, making instcombine's debug output nicer would
be very helpful,
-chris
> using namespace llvm;
> using na
> 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/
>> Right. ConstantInt's are immutable, so it doesn't really need to be
>> marked const. I'm saying that the implementation of these methods
>> shouldn't build a "1" apint, then add it. Instead, it should just
>> increment an apint with ++.
>
> Yup. I've already changed it to:
>
> static Constant
On Sun, 2007-03-25 at 12:25 -0700, Chris Lattner wrote:
> >
> >>> +/// SubOne - Subtract one from a ConstantInt
> >>> static ConstantInt *SubOne(ConstantInt *C) {
> >>
> >> Shouldn't these use ++/-- on APInt? That seems more efficient.
> >
> > I should really have these functions declare the para
On Mar 25, 2007, at 12:10 PM, Reid Spencer wrote:
> On Sun, 2007-03-25 at 11:55 -0700, Chris Lattner wrote:
>>> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
>>> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.687
>>> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:
On Sun, 2007-03-25 at 11:55 -0700, Chris Lattner wrote:
> > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.687
> > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.688
> > --- llvm/lib/Transforms/Scalar/Instruction
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.687
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.688
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.687 Sun
> Mar 25 00:01:29 2007
> +++ llvm/lib/
> @@ -2443,10 +2443,9 @@
>// Check to see if this is an unsigned division with an exact
> power of 2,
>// if so, convert to a right shift.
>if (ConstantInt *C = dyn_cast(Op1)) {
> -APInt Val(C->getValue());
> -if (Val != 0 && Val.isPowerOf2())// Don't break X / 0
> +if
On Mar 24, 2007, at 9:55 PM, Nick Lewycky wrote:
> Chris Lattner wrote:
>> On Mar 23, 2007, at 11:46 AM, Reid Spencer wrote:
>>
>>> // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't
>>> eliminate shr
>>> // of a signed value.
>>> //
>>> - unsigned TypeBits = Op0->getType()->getP
On Sun, 2007-03-25 at 00:55 -0400, Nick Lewycky wrote:
> Chris Lattner wrote:
> > On Mar 23, 2007, at 11:46 AM, Reid Spencer wrote:
> >
> >> // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't
> >>eliminate shr
> >> // of a signed value.
> >> //
> >>- unsigned TypeBits = Op0->get
Chris Lattner wrote:
> On Mar 23, 2007, at 11:46 AM, Reid Spencer wrote:
>
>> // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't
>>eliminate shr
>> // of a signed value.
>> //
>>- unsigned TypeBits = Op0->getType()->getPrimitiveSizeInBits();
>>- if (Op1->getZExtValue() >= TypeB
> @@ -2961,11 +2961,10 @@
>if (CI->isAllOnesValue()) // X * -1 == 0 - X
> return BinaryOperator::createNeg(Op0, I.getName());
>
> - int64_t Val = (int64_t)cast(CI)->getZExtValue();
> - if (isPowerOf2_64(Val)) { // Replace X*(2^C) with X
> << C
> -
On Mar 23, 2007, at 11:46 AM, Reid Spencer wrote:
>// shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't
> eliminate shr
>// of a signed value.
>//
> - unsigned TypeBits = Op0->getType()->getPrimitiveSizeInBits();
> - if (Op1->getZExtValue() >= TypeBits) {
> + if (Op1->getZE
> @@ -4373,9 +4374,10 @@
>
>// See if we can simplify any instructions used by the
> instruction whose sole
>// purpose is to compute bits we don't care about.
> - uint64_t KnownZero, KnownOne;
> + uint32_t BitWidth = cast(I.getType())->getBitWidth();
This is an important regression fo
On Mar 22, 2007, at 1:57 PM, Reid Spencer wrote:
> @@ -7008,10 +7008,8 @@
>case Instruction::ZExt: {
> // We need to emit an AND to clear the high bits.
> assert(SrcBitSize < DestBitSize && "Not a zext?");
> -Constant *C =
> - ConstantInt::get(Type::Int64
>>> Make some codes more efficient.
>>>
>>> @@ -5813,7 +5816,6 @@
>>>case 16 : SExtType = Type::Int16Ty; break;
>>>case 32 : SExtType = Type::Int32Ty; break;
>>>case 64 : SExtType = Type::Int64Ty; break;
>>> - case 128: SExtType = IntegerType::get(128); break;
>>>
On Sat, 2007-03-24 at 10:06 -0700, Chris Lattner wrote:
> On Mar 24, 2007, at 8:34 AM, Zhou Sheng wrote:
>
> >
> >
> > Changes in directory llvm/lib/Transforms/Scalar:
> >
> > InstructionCombining.cpp updated: 1.682 -> 1.683
> > ---
> > Log message:
> >
> > Make some codes more efficient.
> >
> >
On Mar 24, 2007, at 8:34 AM, Zhou Sheng wrote:
>
>
> Changes in directory llvm/lib/Transforms/Scalar:
>
> InstructionCombining.cpp updated: 1.682 -> 1.683
> ---
> Log message:
>
> Make some codes more efficient.
>
> @@ -5813,7 +5816,6 @@
>case 16 : SExtType = Type::Int16Ty; break;
>
>
> Add an APInt version of SimplifyDemandedBits.
>
> Patch by Zhou Sheng.
Commenting on the version from mainline, comments preceeded with ***'s:
static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
*** Mask should be passed by const&.
bool InstCombiner::SimplifyDemandedBits(
On Mar 12, 2007, at 11:41 PM, Zhou Sheng wrote:
> For expression like
> "APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth)",
> to handle ShiftAmt == BitWidth situation, use zextOrCopy() instead of
> zext().
In CVS head instcombine, this zextOrCopy method is only used in one
place. Instead
ComputeMaskedBits had several iterations, here's a review of the one
in CVS now. Comments preceeded by ***.
static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
APInt& KnownOne, unsigned Depth = 0) {
assert(V && "No Value?");
assert(Depth <
> For PR1248: http://llvm.org/PR1248 :
> * Fix some indentation and comments in InsertRangeTest
> * Add an "IsSigned" parameter to AddWithOverflow and make it handle
> signed
> additions. Also, APIntify this function so it works with any
> bitwidth.
> * For the icmp pred ([us]div %X, C1), C2
> APIntify the isHighOnes utility function.
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.668
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.667
On Mar 19, 2007, at 5:02 PM, Chris Lattner wrote:
> On Mar 19, 2007, at 2:21 PM, Reid Spencer wrote:
>> On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote:
Implement isOneBitSet in terms of APInt::countPopulation.
>>>
@@ -3474,8 +3474,7 @@
// isOneBitSet - Return true if there
On Mar 19, 2007, at 2:21 PM, Reid Spencer wrote:
> On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote:
>>> Implement isOneBitSet in terms of APInt::countPopulation.
>>
>>> @@ -3474,8 +3474,7 @@
>>> // isOneBitSet - Return true if there is exactly one bit set in
>>> the specified
>>> // consta
On Mon, 2007-03-19 at 14:16 -0700, Chris Lattner wrote:
> > Implement isOneBitSet in terms of APInt::countPopulation.
>
> > @@ -3474,8 +3474,7 @@
> > // isOneBitSet - Return true if there is exactly one bit set in
> > the specified
> > // constant.
> > static bool isOneBitSet(const ConstantIn
> Implement isOneBitSet in terms of APInt::countPopulation.
> @@ -3474,8 +3474,7 @@
> // isOneBitSet - Return true if there is exactly one bit set in
> the specified
> // constant.
> static bool isOneBitSet(const ConstantInt *CI) {
> - uint64_t V = CI->getZExtValue();
> - return V && (V & (
> 1. Use APInt::getSignBit to reduce clutter (patch by Sheng Zhou)
> 2. Replace uses of the "isPositive" utility function with
> APInt::isPositive
Oooh, beautiful. Nice work guys,
-Chris
>
> ---
> Diffs of the changes: (+4 -8)
>
> InstructionCombining.cpp | 12
> 1 files chan
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.619
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.620
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.619 Thu
> Feb 1 16:30:07 2007
> +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Feb 1
> Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
> diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.68
> llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.69
> --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.68 Sat
> Jan 20 18:29:25 2007
> +++ llvm/lib/Tr
> For this transform: store V, (cast P) -> store (cast V), P
> don't allow the transform if V and the pointer's element type are
> different
> width integer types.
To fix this, I'd vastly prefer that you add
TargetData::getTypeSizeInBits, rather than adding special cases for
variable width i
On Jan 6, 2007, at 9:51 AM, Reid Spencer wrote:
> I believe this patch has broken these two instcombine tests:
>
> FAIL: /proj/llvm/llvm-3/test/Regression/Transforms/InstCombine/
> 2003-11-13-ConstExprCastCall.ll:
> FAIL: /proj/llvm/llvm-3/test/Regression/Transforms/InstCombine/call-
> cast-targ
Chris,
I believe this patch has broken these two instcombine tests:
FAIL:
/proj/llvm/llvm-3/test/Regression/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll:
child process exited abnormally
call i32 (...)* bitcast (void (i8*)* %free to i32 (...)*)( i32*
%X.pntr.s1.u0 ) ; :
On Wed, 2006-12-13 at 09:51 -0800, Chris Lattner wrote:
> > Implement review feedback. Most of this has to do with removing
> > unnecessary
> > cast instructions. A few are bug fixes.
>
> Thanks Reid,
>
> > @@ -4342,9 +4333,8 @@
> >// Check to see if there is a noop-cast between the
On Wed, 2006-12-13 at 09:53 -0800, Chris Lattner wrote:
> > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567
> > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568
> > --- llvm/lib/Transforms/Scalar/Instruction
On Wed, 2006-12-13 at 09:48 -0800, Chris Lattner wrote:
> >>> @@ -5681,7 +5677,7 @@
> >>> /// evaluate the expression.
> >>> Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type
> >>> *Ty) {
> >>>if (Constant *C = dyn_cast(V))
> >>> -return ConstantExpr::getCast(C, Ty);
> >>>
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 Wed
> Dec 13 02:27:15 2006
> +++ llvm/lib/
> Implement review feedback. Most of this has to do with removing
> unnecessary
> cast instructions. A few are bug fixes.
Thanks Reid,
> @@ -4342,9 +4333,8 @@
>// Check to see if there is a noop-cast between the
> shift and the and.
>if (!Shift) {
> if (Ca
On Dec 13, 2006, at 9:20 AM, Reid Spencer wrote:
>>> +static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy,
>>> + Instruction *InsertPoint,
>>> + InstCombiner *IC) {
>>
>> Why did you rename this?
>
> Because the name doe
>>> @@ -5681,7 +5677,7 @@
>>> /// evaluate the expression.
>>> Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type
>>> *Ty) {
>>>if (Constant *C = dyn_cast(V))
>>> -return ConstantExpr::getCast(C, Ty);
>>> +return ConstantExpr::getIntegerCast(C, Ty, C->getType()-
is
Hi Chris,
Feedback below ...
On Tue, 2006-12-12 at 23:14 -0800, Chris Lattner wrote:
> On Dec 12, 2006, at 3:36 PM, Reid Spencer wrote:
> > @@ -3286,7 +3281,8 @@
> > Op1C-
> > >getOperand(0),
> >
Hi Chris,
Feedback below ...
On Tue, 2006-12-12 at 22:42 -0800, Chris Lattner wrote:
> This code (around line 2173):
>
>CastInst *BoolCast = 0;
>if (CastInst *CI = dyn_cast(I.getOperand(0)))
> if (CI->getOperand(0)->getType() == Type::BoolTy)
>BoolCast = CI;
>if (!BoolCa
On Dec 12, 2006, at 3:36 PM, Reid Spencer wrote:
> @@ -3286,7 +3281,8 @@
> Op1C-
> >getOperand(0),
> I.getName());
> InsertNewInstBefore(NewOp, I);
> -return CastInst::c
This code (around line 2173):
CastInst *BoolCast = 0;
if (CastInst *CI = dyn_cast(I.getOperand(0)))
if (CI->getOperand(0)->getType() == Type::BoolTy)
BoolCast = CI;
if (!BoolCast)
if (CastInst *CI = dyn_cast(I.getOperand(1)))
if (CI->getOperand(0)->getType() == Ty
On Dec 12, 2006, at 11:07 AM, Reid Spencer wrote:
> On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote:
>>
>> Changes in directory llvm/lib/Transforms/Scalar:
>>
>> InstructionCombining.cpp updated: 1.563 -> 1.564
>> ---
>> Log message:
>>
>> Fix regression on 400.perlbench last night.
>
> Ch
On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote:
>
> Changes in directory llvm/lib/Transforms/Scalar:
>
> InstructionCombining.cpp updated: 1.563 -> 1.564
> ---
> Log message:
>
> Fix regression on 400.perlbench last night.
Chris, Thanks. I should have SPEC2006 in a few weeks. Are you su
On Dec 4, 2006, at 10:33 AM, Reid Spencer wrote:
> On Mon, 2006-12-04 at 10:22 -0800, Chris Lattner wrote:
>>>// If this is another cast that can be eliminated, it isn't
>>> codegen either.
>>>if (const CastInst *CI = dyn_cast(V))
>>> -if (isEliminableCastPair(CI, CastInst::getCastOpc
On Mon, 2006-12-04 at 10:22 -0800, Chris Lattner wrote:
> >// If this is another cast that can be eliminated, it isn't
> > codegen either.
> >if (const CastInst *CI = dyn_cast(V))
> > -if (isEliminableCastPair(CI, CastInst::getCastOpcode(V, Ty),
> > Ty, TD))
> > +if (isEliminabl
> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.557
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.558
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.557 Fri
> Dec 1 18:13:08 2006
> +++ llvm/lib/
Oops .. sorry about that.
On Fri, 2006-10-20 at 13:20 -0500, Chris Lattner wrote:
>
> Changes in directory llvm/lib/Transforms/Scalar:
>
> InstructionCombining.cpp updated: 1.526 -> 1.527
> ---
> Log message:
>
> Fix miscompilation of MallocBench/espresso which code review pointed out
> but app
65 matches
Mail list logo