[llvm-commits] [llvm] r74041 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Dan Gohman
gohman at apple.com
Tue Jun 23 17:54:58 PDT 2009
Author: djg
Date: Tue Jun 23 19:54:57 2009
New Revision: 74041
URL: http://llvm.org/viewvc/llvm-project?rev=74041&view=rev
Log:
Move the special cases for constants out of getUnknown and into
createSCEV. Also, recognize UndefValue in createSCEV.
Change getIntegerSCEV's comment to avoid mentioning FP types,
and re-implement it in terms of getConstant instead of getUnknown.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=74041&r1=74040&r2=74041&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Tue Jun 23 19:54:57 2009
@@ -462,7 +462,7 @@
/// widening.
const SCEV* getTruncateOrNoop(const SCEV* V, const Type *Ty);
- /// getIntegerSCEV - Given an integer or FP type, create a constant for the
+ /// getIntegerSCEV - Given a SCEVable type, create a constant for the
/// specified signed integer value and return a SCEV for the constant.
const SCEV* getIntegerSCEV(int Val, const Type *Ty);
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=74041&r1=74040&r2=74041&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Jun 23 19:54:57 2009
@@ -1867,10 +1867,11 @@
}
const SCEV* ScalarEvolution::getUnknown(Value *V) {
- if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
- return getConstant(CI);
- if (isa<ConstantPointerNull>(V))
- return getIntegerSCEV(0, V->getType());
+ // Don't attempt to do anything other than create a SCEVUnknown object
+ // here. createSCEV only calls getUnknown after checking for all other
+ // interesting possibilities, and any other code that calls getUnknown
+ // is doing so in order to hide a value from SCEV canonicalization.
+
SCEVUnknown *&Result = SCEVUnknowns[V];
if (Result == 0) Result = new SCEVUnknown(V);
return Result;
@@ -1948,19 +1949,11 @@
return S;
}
-/// getIntegerSCEV - Given an integer or FP type, create a constant for the
+/// getIntegerSCEV - Given a SCEVable type, create a constant for the
/// specified signed integer value and return a SCEV for the constant.
const SCEV* ScalarEvolution::getIntegerSCEV(int Val, const Type *Ty) {
- Ty = getEffectiveSCEVType(Ty);
- Constant *C;
- if (Val == 0)
- C = Constant::getNullValue(Ty);
- else if (Ty->isFloatingPoint())
- C = ConstantFP::get(APFloat(Ty==Type::FloatTy ? APFloat::IEEEsingle :
- APFloat::IEEEdouble, Val));
- else
- C = ConstantInt::get(Ty, Val);
- return getUnknown(C);
+ const IntegerType *ITy = cast<IntegerType>(getEffectiveSCEVType(Ty));
+ return getConstant(ConstantInt::get(ITy, Val));
}
/// getNegativeSCEV - Return a SCEV corresponding to -V = -1*V
@@ -2429,6 +2422,12 @@
Opcode = I->getOpcode();
else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
Opcode = CE->getOpcode();
+ else if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
+ return getConstant(CI);
+ else if (isa<ConstantPointerNull>(V))
+ return getIntegerSCEV(0, V->getType());
+ else if (isa<UndefValue>(V))
+ return getIntegerSCEV(0, V->getType());
else
return getUnknown(V);
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=74041&r1=74040&r2=74041&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jun 23 19:54:57 2009
@@ -644,7 +644,7 @@
const MachineOperand &MO = MI->getOperand(Op);
uint32_t v = ~MO.getImm();
int32_t lsb = ffs (v) - 1;
- int32_t width = fls (v) - lsb;
+ int32_t width = ffs (v) - lsb;
assert(MO.isImm() && "Not a valid bf_inv_mask_imm value!");
O << "#" << lsb << ", #" << width;
}
More information about the llvm-commits
mailing list