[llvm-commits] [llvm] r49697 - in /llvm/branches/ggreif/use-diet/lib/Transforms: IPO/GlobalDCE.cpp IPO/IPConstantPropagation.cpp Scalar/DCE.cpp Scalar/InstructionCombining.cpp
Gabor Greif
ggreif at gmail.com
Mon Apr 14 16:20:19 PDT 2008
Author: ggreif
Date: Mon Apr 14 18:20:15 2008
New Revision: 49697
URL: http://llvm.org/viewvc/llvm-project?rev=49697&view=rev
Log:
fix performance bug by not passing Use by value to dyn_cast
Modified:
llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalDCE.cpp
llvm/branches/ggreif/use-diet/lib/Transforms/IPO/IPConstantPropagation.cpp
llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/DCE.cpp
llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalDCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalDCE.cpp?rev=49697&r1=49696&r2=49697&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalDCE.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/GlobalDCE.cpp Mon Apr 14 18:20:15 2008
@@ -158,9 +158,9 @@
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
// For all operands...
for (User::op_iterator U = I->op_begin(), E = I->op_end(); U != E; ++U)
- if (GlobalValue *GV = dyn_cast<GlobalValue>(*U))
+ if (GlobalValue *GV = dyn_cast<GlobalValue>(U->get()))
GlobalIsNeeded(GV);
- else if (Constant *C = dyn_cast<Constant>(*U))
+ else if (Constant *C = dyn_cast<Constant>(U->get()))
MarkUsedGlobalsAsNeeded(C);
}
}
Modified: llvm/branches/ggreif/use-diet/lib/Transforms/IPO/IPConstantPropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=49697&r1=49696&r2=49697&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/IPO/IPConstantPropagation.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/IPO/IPConstantPropagation.cpp Mon Apr 14 18:20:15 2008
@@ -98,7 +98,7 @@
if (*AI == &F) return false; // Passes the function into itself
if (!ArgumentConstants[i].second) {
- if (Constant *C = dyn_cast<Constant>(*AI)) {
+ if (Constant *C = dyn_cast<Constant>(AI->get())) {
if (!ArgumentConstants[i].first)
ArgumentConstants[i].first = C;
else if (ArgumentConstants[i].first != C) {
Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/DCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/DCE.cpp?rev=49697&r1=49696&r2=49697&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/DCE.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/DCE.cpp Mon Apr 14 18:20:15 2008
@@ -102,7 +102,7 @@
// go dead after this one is removed.
//
for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI)
- if (Instruction *Used = dyn_cast<Instruction>(*OI))
+ if (Instruction *Used = dyn_cast<Instruction>(OI->get()))
WorkList.push_back(Used);
// Remove the instruction.
Modified: llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/InstructionCombining.cpp?rev=49697&r1=49696&r2=49697&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 14 18:20:15 2008
@@ -8484,7 +8484,7 @@
// the call.
for (CallSite::arg_iterator I = CS.arg_begin()+FTy->getNumParams(),
E = CS.arg_end(); I != E; ++I)
- if (CastInst *CI = dyn_cast<CastInst>(*I)) {
+ if (CastInst *CI = dyn_cast<CastInst>(I->get())) {
// If this cast does not effect the value passed through the varargs
// area, we can eliminate the use of the cast.
Value *Op = CI->getOperand(0);
@@ -8575,7 +8575,7 @@
if (CallerPAL.getParamAttrs(i + 1) & ParamAttr::typeIncompatible(ParamTy))
return false; // Attribute not compatible with transformed value.
- ConstantInt *c = dyn_cast<ConstantInt>(*AI);
+ ConstantInt *c = dyn_cast<ConstantInt>(AI->get());
// Some conversions are safe even if we do not have a body.
// Either we can cast directly, or we can upconvert the argument
bool isConvertible = ActTy == ParamTy ||
More information about the llvm-commits
mailing list