[PATCH] D11242: Fix assert when inlining a constantexpr addrspacecast
Matthew.Arsenault at amd.com
Wed Jul 22 11:54:52 PDT 2015
arsenm added inline comments.
Comment at: lib/Analysis/ConstantFolding.cpp:250
@@ -249,2 +249,3 @@
// Look through ptr->int and ptr->ptr casts.
if (CE->getOpcode() == Instruction::PtrToInt ||
+ CE->getOpcode() == Instruction::BitCast)
> majnemer wrote:
> > Isn't there still a bug here? The size of the result type of `ptrtoint` can disagree with its operand's type.
> > Sounds like the correct thing to do would be to call the static member function `CastInst::isNoopCast` with appropriate operands.
> This is what I thought at first to, but ptrtoints with noncanonical integer sizes seem to work. I'm not exactly sure why
I think I understand why it isn't necessary to worry about that case. Because this doesn't look through inttoptr, we don't see pointer size changes through the ptrtoint/inttoptr path.
More information about the llvm-commits