projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
08993c0
)
Add a fast path for x - x.
author
Dan Gohman
<gohman@apple.com>
Tue, 20 Jul 2010 16:53:00 +0000
(16:53 +0000)
committer
Dan Gohman
<gohman@apple.com>
Tue, 20 Jul 2010 16:53:00 +0000
(16:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108855
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
patch
|
blob
|
history
diff --git
a/lib/Analysis/ScalarEvolution.cpp
b/lib/Analysis/ScalarEvolution.cpp
index f0bc9360b16d687554fad86b1cde200c80a19402..179aa8867d6d846df1b09bb8f74ef428f0b1c18b 100644
(file)
--- a/
lib/Analysis/ScalarEvolution.cpp
+++ b/
lib/Analysis/ScalarEvolution.cpp
@@
-2442,6
+2442,10
@@
const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) {
///
const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS,
const SCEV *RHS) {
+ // Fast path: X - X --> 0.
+ if (LHS == RHS)
+ return getConstant(LHS->getType(), 0);
+
// X - Y --> X + -Y
return getAddExpr(LHS, getNegativeSCEV(RHS));
}