[PATCH] D35003: [MemoryBuiltins] Allow truncation in visitAllocaInst()
George Burgess IV via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 06:11:01 PDT 2017
george.burgess.iv added inline 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);
----------------
uabelho wrote:
> 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.
Yes, please.
I'm not 100% sure if testing this will be straightforward, though. If it seems nontrivial, just let me know. Since it's my nit, I'm happy to try to make a test for overflow and commit it after this lands. :)
https://reviews.llvm.org/D35003
More information about the llvm-commits
mailing list