[polly] r190384 - TempScopInfo: Microoptimize constant conditions
Tobias Grosser
tobias at grosser.es
Mon Sep 9 21:47:19 PDT 2013
Author: grosser
Date: Mon Sep 9 23:47:19 2013
New Revision: 190384
URL: http://llvm.org/viewvc/llvm-project?rev=190384&view=rev
Log:
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 at gmail.com>
Modified:
polly/trunk/lib/Analysis/TempScopInfo.cpp
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=190384&r1=190383&r2=190384&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Mon Sep 9 23:47:19 2013
@@ -230,14 +230,15 @@ void TempScopInfo::buildLoopBounds(TempS
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;
}
More information about the llvm-commits
mailing list