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

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 05:47:39 PDT 2017


uabelho added a comment.

Thanks for the comments!



================
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);
----------------
george.burgess.iv wrote:
> 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?
So you want me to detect if overflow actually happens and if so return unknown(), and add a testcase for the overflow case as well?

If so, yes I'll try.


https://reviews.llvm.org/D35003





More information about the llvm-commits mailing list