[llvm-commits] InstCombining, small bug alloca + bitcast

Duncan Sands baldrick at free.fr
Sat May 5 01:39:24 PDT 2012


Hi Stepan,

> I also added some usefull checks to test and fixed InstCombineCasts.cpp.

what was wrong with InstCombineCasts?  In fact the existing check

     // Cannot look past anything that might overflow.
     OverflowingBinaryOperator *OBI = dyn_cast<OverflowingBinaryOperator>(Val);
     if (OBI && !OBI->hasNoUnsignedWrap()) {
       Scale = 1;
       Offset = 0;
       return Val;
     }

looks bogus to me: without it, you correctly get Scale and Offset such that
Val = X*Scale + Offset, which is what the routine is supposed to do according
to the comment describing it.

So if this check is really needed, it must be because of some undocumented
semantics in how the routine is supposed to behave.  What are these semantics?
They should be documented.  Once it is clear what this routine is supposed to
be doing, it should become clear whether your change is correct or not.

Ciao, Duncan.



More information about the llvm-commits mailing list