Details
Details
- Reviewers
majnemer
Diff Detail
Diff Detail
Event Timeline
lib/Analysis/ConstantFolding.cpp | ||
---|---|---|
1232–1246 | This is suspicious to me. It implies that performing a ConstantExpr::getCast(Instruction::AddrSpaceCast) on an IntToPtr does the wrong thing and suggests to me that the bug lies elsewhere. |
Comment Actions
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.
Comment Actions
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
This is suspicious to me. It implies that performing a ConstantExpr::getCast(Instruction::AddrSpaceCast) on an IntToPtr does the wrong thing and suggests to me that the bug lies elsewhere.