[PATCH] D23723: [SLP] Avoid signed integer overflow

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 14:37:03 PDT 2016


mssimpso updated the summary for this revision.
mssimpso added a subscriber: gberry.
mssimpso updated this revision to Diff 68913.
mssimpso added a comment.
Herald added a reviewer: vkalintiris.

Hi Michael,

According to @gberry, the signed SaturatingAdd implementation I added isn't well-defined as you guessed. I started rewriting it, but I think a better solution might be to avoid INT_MAX all together. We're using INT_MAX to essentially indicate "do not vectorize". I think it makes better sense to put the INT_MAX logic in a function that returns a bool.

I've updated the patch to do this. I've also kept the existing test case intact, and added a new run-line checking for no vectorization. The test was being vectorized by chance due to the undefined behavior.


https://reviews.llvm.org/D23723

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Transforms/SLPVectorizer/AArch64/gather-root.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23723.68913.patch
Type: text/x-patch
Size: 3814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160822/1b18d007/attachment.bin>


More information about the llvm-commits mailing list