[PATCH] D35003: [MemoryBuiltins] Allow truncation in visitAllocaInst()

George Burgess IV via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 05:34:44 PDT 2017


george.burgess.iv added a comment.

Thanks for this! One nit, and I think it looks good.



================
Comment at: lib/Analysis/MemoryBuiltins.cpp:518
   if (const ConstantInt *C = dyn_cast<ConstantInt>(ArraySize)) {
-    Size *= C->getValue().zextOrSelf(IntTyBits);
+    Size *= C->getValue().zextOrTrunc(IntTyBits);
     return std::make_pair(align(Size, I.getAlignment()), Zero);
----------------
Addressing your comment: I realize that this is an existing inconsistency, but we try to return `unknown()` if an overflow happens (e.g. on line 597). While we're in the area, can we make this test for overflow too, please?


https://reviews.llvm.org/D35003





More information about the llvm-commits mailing list