diff options
author | Jingyue Wu <jingyue@google.com> | 2014-06-17 00:42:07 +0000 |
---|---|---|
committer | Jingyue Wu <jingyue@google.com> | 2014-06-17 00:42:07 +0000 |
commit | dcc92918519125050edd5823567179143b20042a (patch) | |
tree | 98286f32d174b34f057a2052e1c4bf4c5055c7c8 /lib/Transforms/InstCombine/InstCombine.h | |
parent | 4072aa3649ff90ab4ea2b7c7ff5970ec1be496eb (diff) | |
download | llvm-dcc92918519125050edd5823567179143b20042a.tar.gz llvm-dcc92918519125050edd5823567179143b20042a.tar.bz2 llvm-dcc92918519125050edd5823567179143b20042a.tar.xz |
[InstCombine] mark ADD with nuw if no unsigned overflow
Summary:
As a starting step, we only use one simple heuristic: if the sign bits
of both a and b are zero, we can prove "add a, b" do not unsigned
overflow, and thus convert it to "add nuw a, b".
Updated all affected tests and added two new tests (@zero_sign_bit and
@zero_sign_bit2) in AddOverflow.ll
Test Plan: make check-all
Reviewers: eliben, rafael, meheff, chandlerc
Reviewed By: chandlerc
Subscribers: chandlerc, llvm-commits
Differential Revision: http://reviews.llvm.org/D4144
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombine.h')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombine.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombine.h b/lib/Transforms/InstCombine/InstCombine.h index ea1839c3bc..ab4dc1ce23 100644 --- a/lib/Transforms/InstCombine/InstCombine.h +++ b/lib/Transforms/InstCombine/InstCombine.h @@ -247,6 +247,7 @@ private: bool DoXform = true); Instruction *transformSExtICmp(ICmpInst *ICI, Instruction &CI); bool WillNotOverflowSignedAdd(Value *LHS, Value *RHS); + bool WillNotOverflowUnsignedAdd(Value *LHS, Value *RHS); Value *EmitGEPOffset(User *GEP); Instruction *scalarizePHI(ExtractElementInst &EI, PHINode *PN); Value *EvaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask); |