summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-03-24 10:29:52 +0000
committerGabor Greif <ggreif@gmail.com>2010-03-24 10:29:52 +0000
commit9027ffb918d5d1fc7b03c5c5f8a4f7db4e5709df (patch)
tree5c1b8163a73f25ad1891aef1d4f366bd7e7c644a /llvm/lib/Transforms
parent11ff53146f307802a5dfbfdd9ab7b0cd428113f8 (diff)
downloadbcm5719-llvm-9027ffb918d5d1fc7b03c5c5f8a4f7db4e5709df.tar.gz
bcm5719-llvm-9027ffb918d5d1fc7b03c5c5f8a4f7db4e5709df.zip
increase const goodness and remove pointless getUser() calls
llvm-svn: 99395
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 7e37938868d..e28478c256c 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1705,28 +1705,30 @@ ModulePass *llvm::createIPSCCPPass() {
}
-static bool AddressIsTaken(GlobalValue *GV) {
+static bool AddressIsTaken(const GlobalValue *GV) {
// Delete any dead constantexpr klingons.
GV->removeDeadConstantUsers();
- for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end();
- UI != E; ++UI)
- if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
+ for (Value::use_const_iterator UI = GV->use_begin(), E = GV->use_end();
+ UI != E; ++UI) {
+ const User *U = *UI;
+ if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
if (SI->getOperand(0) == GV || SI->isVolatile())
return true; // Storing addr of GV.
- } else if (isa<InvokeInst>(*UI) || isa<CallInst>(*UI)) {
+ } else if (isa<InvokeInst>(U) || isa<CallInst>(U)) {
// Make sure we are calling the function, not passing the address.
if (UI.getOperandNo() != 0)
return true;
- } else if (LoadInst *LI = dyn_cast<LoadInst>(*UI)) {
+ } else if (const LoadInst *LI = dyn_cast<LoadInst>(U)) {
if (LI->isVolatile())
return true;
- } else if (isa<BlockAddress>(*UI)) {
+ } else if (isa<BlockAddress>(U)) {
// blockaddress doesn't take the address of the function, it takes addr
// of label.
} else {
return true;
}
+ }
return false;
}
OpenPOWER on IntegriCloud