[PATCH] D11242: Fix assert when inlining a constantexpr addrspacecast

Matt Arsenault Matthew.Arsenault at amd.com
Wed Jul 15 15:06:24 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


http://reviews.llvm.org/D11242







More information about the llvm-commits mailing list