[PATCH] Don't constant fold bitcast/ptrtoint/inttoptr combinations without datalayout

Eli Friedman eli.friedman at gmail.com
Sun Jul 21 16:39:27 PDT 2013


>From earlier in the thread:

> I was thinking that for a while, but the original code would only fold if the intermediate integer was at least as big as the pointer size, so this was trying to match that behavior. It could constant fold even if the middle integer size is unknown, but that would change the behavior if the middle integer was smaller (I'm not sure why you would ever want that though).

That applies to folding inttoptr+ptrtoint, but I fail to see how it
applies to folding bitcast+ptrtoint.

-Eli

On Sun, Jul 21, 2013 at 2:21 AM, Matt Arsenault
<Matthew.Arsenault at amd.com> wrote:
>   Allow folding bitcast -> ptrtoint when the address spaces are the same.
>
>   Fix inline testcase by making it use casts that can still be folded away.
>
> Hi eli.friedman,
>
> http://llvm-reviews.chandlerc.com/D1157
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D1157?vs=2846&id=2932#toc
>
> Files:
>   lib/IR/ConstantFold.cpp
>   lib/IR/Instructions.cpp
>   test/Transforms/Inline/inline_constprop.ll
>   unittests/IR/InstructionsTest.cpp




More information about the llvm-commits mailing list