[llvm-commits] [poolalloc] r75469 - /poolalloc/trunk/lib/DSA/Local.cpp
John Criswell
criswell at uiuc.edu
Mon Jul 13 08:48:58 PDT 2009
Author: criswell
Date: Mon Jul 13 10:48:58 2009
New Revision: 75469
URL: http://llvm.org/viewvc/llvm-project?rev=75469&view=rev
Log:
Fixed last commit. I'm not sure if there exists a way to generate a "zero"
value for any type, but in this case, we know that we're checking integers.
Therefore, use the isZero() method of ConstantInt to check that all the
integer operands of a GEP are zeros.
Modified:
poolalloc/trunk/lib/DSA/Local.cpp
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=75469&r1=75468&r2=75469&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Mon Jul 13 10:48:58 2009
@@ -373,12 +373,14 @@
// As a special case, if all of the index operands of GEP are constant zeros,
// handle this just like we handle casts (ie, don't do much).
bool AllZeros = true;
- for (unsigned i = 1, e = GEP.getNumOperands(); i != e; ++i)
- if (GEP.getOperand(i) !=
- ConstantAggregateZero::get(GEP.getOperand(i)->getType())) {
- AllZeros = false;
- break;
- }
+ for (unsigned i = 1, e = GEP.getNumOperands(); i != e; ++i) {
+ if (ConstantInt * CI = dyn_cast<ConstantInt>(GEP.getOperand(i)))
+ if (CI->isZero()) {
+ continue;
+ }
+ AllZeros = false;
+ break;
+ }
// If all of the indices are zero, the result points to the operand without
// applying the type.
More information about the llvm-commits
mailing list