[llvm-commits] [llvm] r92411 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/load-cmp.ll
Chris Lattner
clattner at apple.com
Mon Jan 4 10:50:13 PST 2010
On Jan 4, 2010, at 10:17 AM, Duncan Sands wrote:
> Hi Bill,
>
>>> nice transform. However if this is not an inbounds GEP and the
>>> index "i" is
>>>> 64 bits on a 32 bit machine, then there are other possible values
>>>> for "i",
>>>> such as i == 6 + 232.
>>>>
>> At least in C, accessing outside of an array is undefined. Isn't
>> this a case of "they get what they deserve"? :-)
>
> front-ends should turn C array accesses into inbounds GEPs, so my
> comment
> wouldn't apply to code coming from C. In fact it probably doesn't
> apply
> to code from any language - it's a theoretical correctness issue
> rather
> than a practical one :) I guess it can be fixed by truncating i to
> the
> pointer size for the target before doing the compare.
Duncan's right about this, I'll fix it. Unfortunately, this will make
the xform require TD information, but hey, correctness is king.
-Chris
More information about the llvm-commits
mailing list