[llvm-commits] [llvm] r132926 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll

Duncan Sands baldrick at free.fr
Mon Jun 13 12:57:12 PDT 2011


Hi Stuart,

> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon Jun 13 13:48:49 2011
> @@ -71,6 +71,11 @@
>     // This requires TargetData to get the alloca alignment and size information.
>     if (!TD) return 0;
>
> +  // Insist that the amount-to-allocate not overflow.
> +  OverflowingBinaryOperator *OBI =
> +    dyn_cast<OverflowingBinaryOperator>(AI.getOperand(0));
> +  if (OBI&&  !(OBI->hasNoSignedWrap() || OBI->hasNoUnsignedWrap())) return 0;

is it correct to allow both nsw and nuw here?  Is the amount signed or unsigned?

Ciao, Duncan.



More information about the llvm-commits mailing list