[llvm-commits] [llvm] r107990 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Gabor Greif
ggreif at gmail.com
Fri Jul 9 09:51:20 PDT 2010
Author: ggreif
Date: Fri Jul 9 11:51:20 2010
New Revision: 107990
URL: http://llvm.org/viewvc/llvm-project?rev=107990&view=rev
Log:
cache result of operator*
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=107990&r1=107989&r2=107990&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Fri Jul 9 11:51:20 2010
@@ -160,13 +160,12 @@
static bool AnalyzeGlobal(const Value *V, GlobalStatus &GS,
SmallPtrSet<const PHINode*, 16> &PHIUsers) {
for (Value::const_use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;
- ++UI)
- if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
+ ++UI) {
+ const User *U = *UI;
+ if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) {
GS.HasNonInstructionUser = true;
-
if (AnalyzeGlobal(CE, GS, PHIUsers)) return true;
-
- } else if (const Instruction *I = dyn_cast<Instruction>(*UI)) {
+ } else if (const Instruction *I = dyn_cast<Instruction>(U)) {
if (!GS.HasMultipleAccessingFunctions) {
const Function *F = I->getParent()->getParent();
if (GS.AccessingFunction == 0)
@@ -235,7 +234,7 @@
} else {
return true; // Any other non-load instruction might take address!
}
- } else if (const Constant *C = dyn_cast<Constant>(*UI)) {
+ } else if (const Constant *C = dyn_cast<Constant>(U)) {
GS.HasNonInstructionUser = true;
// We might have a dead and dangling constant hanging off of here.
if (!SafeToDestroyConstant(C))
@@ -245,6 +244,7 @@
// Otherwise must be some other user.
return true;
}
+ }
return false;
}
More information about the llvm-commits
mailing list