diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-18 19:56:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-18 19:56:20 +0000 |
commit | 96940cb5223d8441f3710b75063a0ee5a3c824ed (patch) | |
tree | abe457ae2d80b7ad724a9afa37fb4bca32d532e2 /lib | |
parent | 9db07b9307d7e48001d816af32eaa1db6f17b0b9 (diff) | |
download | external_llvm-96940cb5223d8441f3710b75063a0ee5a3c824ed.zip external_llvm-96940cb5223d8441f3710b75063a0ee5a3c824ed.tar.gz external_llvm-96940cb5223d8441f3710b75063a0ee5a3c824ed.tar.bz2 |
Strip out and simplify some code. This also fixes the regression last
night compiling cfrac. It did not realize that code like this:
int G; int *H = &G;
takes the address of G.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 3478d9d..6f01f25 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -44,16 +44,9 @@ Pass *llvm::createGlobalConstifierPass() { return new Constifier(); } /// static bool isStoredThrough(Value *V) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) - if (Constant *C = dyn_cast<Constant>(*UI)) { - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { - if (isStoredThrough(CE)) - return true; - } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) { - if (isStoredThrough(GV)) return true; - } else { - // Must be an element of a constant array or something. + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) { + if (isStoredThrough(CE)) return true; - } } else if (Instruction *I = dyn_cast<Instruction>(*UI)) { if (I->getOpcode() == Instruction::GetElementPtr) { if (isStoredThrough(I)) return true; |