[LLVMdev] instcombine Question
Chris Lattner
clattner at apple.com
Wed Jul 16 13:37:08 PDT 2008
On Jul 16, 2008, at 1:32 PM, David Greene wrote:
> I see instcombine doing something I'm not sure is right.
>
> Incoming, I have this:
>
> %r29 = ptrtoint [71 x i64]* %"t$3" to i64 ; <i64> [#uses=1]
> %r30 = inttoptr i64 %r29 to i64* ; <i64*> [#uses=1]
> store i64 72057594037927936, i64* %r30, align 8
>
> Outgoing, I have this:
>
> %r30 = getelementptr [71 x i64]* %"t$3", i32 0, i32 0 ; <i64*>
> [#uses=1]
> store i64 72057594037927936, i64* %r30, align 16
>
> I believe the alignment on the outgoing store is wrong, but my
> question
> concerns the optimization of the ptrtoint / intoptr to a gep. Is this
> optimization allowed to pun the pointer type like this or should
> there be
> a bitcast to i64* in there somewhere?
With what you've shown, the transformation is valid. instcombine will
increase the alignment when it knows it is safe. Is %"t$3" derived
from something provably 16-byte aligned?
-Chris
More information about the llvm-dev
mailing list