[llvm-commits] [llvm] r139006 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/LoopUnroll/pr10813.ll

Duncan Sands baldrick at free.fr
Fri Sep 2 09:09:40 PDT 2011


Hi Jakub,

> --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
> +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Fri Sep  2 10:43:43 2011
> @@ -761,6 +761,10 @@
>
>     if (ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) {
>       if (ConstantInt *CIdx = dyn_cast<ConstantInt>(Idx)) {
> +      uint64_t Index = CIdx->getZExtValue();
> +      if (Index>= CVal->getNumOperands())
> +        // ee({w,x,y,z}, wrong_value) ->  w (an arbitrary value).
> +        return CVal->getOperand(0);

why don't you return undef here?

Ciao, Duncan.



More information about the llvm-commits mailing list