diff options
author | Tobias Grosser <tobias@grosser.es> | 2013-09-10 04:47:19 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2013-09-10 04:47:19 +0000 |
commit | e2622c2accc2e865f31a497b62f9bfebf84690f4 (patch) | |
tree | 75230770daa59dfd9c37ee37ec7a4ed8f9e5e230 /polly | |
parent | abc1a5cb9b430e9eeddbbd822a19f6197d82e121 (diff) | |
download | bcm5719-llvm-e2622c2accc2e865f31a497b62f9bfebf84690f4.tar.gz bcm5719-llvm-e2622c2accc2e865f31a497b62f9bfebf84690f4.zip |
TempScopInfo: Microoptimize constant conditions
Use 0 >= 1 instead of 0 != 0 to represent 'false'. This might be slightly more
efficient as isl may create a union of sets for 0 != 0, whereas this is never
needed for the expression 0 >= 1.
Contributed-by: Alexandre Isoard <alexandre.isoard@gmail.com>
llvm-svn: 190384
Diffstat (limited to 'polly')
-rw-r--r-- | polly/lib/Analysis/TempScopInfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp index 066f06811a4..dfcfc2b5b8b 100644 --- a/polly/lib/Analysis/TempScopInfo.cpp +++ b/polly/lib/Analysis/TempScopInfo.cpp @@ -230,14 +230,15 @@ void TempScopInfo::buildLoopBounds(TempScop &Scop) { void TempScopInfo::buildAffineCondition(Value &V, bool inverted, Comparison **Comp) const { if (ConstantInt *C = dyn_cast<ConstantInt>(&V)) { - // If this is always true condition, we will create 0 == 0, - // otherwise we will create 0 != 0. + // If this is always true condition, we will create 0 <= 1, + // otherwise we will create 0 >= 1. const SCEV *LHS = SE->getConstant(C->getType(), 0); + const SCEV *RHS = SE->getConstant(C->getType(), 1); if (C->isOne() == inverted) - *Comp = new Comparison(LHS, LHS, ICmpInst::ICMP_NE); + *Comp = new Comparison(LHS, RHS, ICmpInst::ICMP_SLE); else - *Comp = new Comparison(LHS, LHS, ICmpInst::ICMP_EQ); + *Comp = new Comparison(LHS, RHS, ICmpInst::ICMP_SGE); return; } |