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 | 33bd53df7f9b635499508fcbaf0fdb3d2e331211 (patch) | |
| tree | 164261494495085a28ca680a89702a6b75056114 /llvm/lib/Transforms/InstCombine/InstCombine.h | |
| parent | b07f1e1fdd0b35be087c6c49fe8e7da1134e64c5 (diff) | |
| download | bcm5719-llvm-33bd53df7f9b635499508fcbaf0fdb3d2e331211.tar.gz bcm5719-llvm-33bd53df7f9b635499508fcbaf0fdb3d2e331211.zip | |
[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
llvm-svn: 211084
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombine.h')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombine.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h index ea1839c3bcf..ab4dc1ce23e 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombine.h +++ b/llvm/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); |

