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

David Majnemer david.majnemer at gmail.com
Wed Jul 15 14:50:03 PDT 2015


majnemer added a subscriber: majnemer.

================
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)
----------------
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.


http://reviews.llvm.org/D11242







More information about the llvm-commits mailing list