[PATCH] D20144: Fix constant folding of addrspacecast
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 15:59:37 PDT 2016
arsenm added a comment.
In http://reviews.llvm.org/D20144#436115, @majnemer wrote:
> Er, I'm still very confused here. Let's take your example `@constant_fold_inttoptr`.
>
> trunk turns this into:
>
> define void @constant_fold_inttoptr() {
> store i32 7, i32 addrspace(4)* addrspacecast (i32 addrspace(3)* inttoptr (i32 -1 to i32 addrspace(3)*) to i32 addrspace(4)*)
> ret void
> }
>
>
> I'm not seeing an argument as to why this is not desirable. The target should still have all the information it needs, the only difference I see is that contains an additional `ConstantExpr` instead of an additional `Instruction`.
The constant value for a pointer in one address space may not match the value in another address space, so constant folding it to the same constant is incorrect
http://reviews.llvm.org/D20144
More information about the llvm-commits
mailing list