summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChen Zheng <shchenz@cn.ibm.com>2018-07-21 12:27:54 +0000
committerChen Zheng <shchenz@cn.ibm.com>2018-07-21 12:27:54 +0000
commitebc7653063d1a9cdd6f613e076b561bad5bc2dc7 (patch)
treef0250b855f70bcc1c1f73df5ecb18211d155f77a /include
parent1d13545e10c5574a40821115d10c54c16f7c47be (diff)
[InstrSimplify] fold sdiv if two operands are negated and non-overflow
Differential Revision: https://reviews.llvm.org/D49382 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337642 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ValueTracking.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index 0b6bdf38cbf..e6a219a8045 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -102,7 +102,10 @@ class Value;
const DominatorTree *DT = nullptr);
/// Return true if the two given values are negation.
- bool isKnownNegation(const Value *X, const Value *Y);
+ /// Currently can recoginze Value pair:
+ /// 1: <X, Y> if X = sub (0, Y) or Y = sub (0, X)
+ /// 2: <X, Y> if X = sub (A, B) and Y = sub (B, A)
+ bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW = false);
/// Returns true if the give value is known to be non-negative.
bool isKnownNonNegative(const Value *V, const DataLayout &DL,