Chris Lattner | eef2fe7 | 2006-01-24 04:13:11 +0000 | [diff] [blame] | 1 | //===-- Globals.cpp - Implement the GlobalValue & GlobalVariable class ----===// |
Misha Brukman | b1c9317 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 2 | // |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | b1c9317 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 7 | // |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Chandler Carruth | ef860a2 | 2013-01-02 09:10:48 +0000 | [diff] [blame] | 10 | // This file implements the GlobalValue & GlobalVariable classes for the IR |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 11 | // library. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 15 | #include "llvm/IR/GlobalValue.h" |
Anton Korobeynikov | da7db7d | 2008-03-11 22:28:56 +0000 | [diff] [blame] | 16 | #include "llvm/ADT/SmallPtrSet.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 17 | #include "llvm/IR/Constants.h" |
| 18 | #include "llvm/IR/DerivedTypes.h" |
| 19 | #include "llvm/IR/GlobalAlias.h" |
| 20 | #include "llvm/IR/GlobalVariable.h" |
Chandler Carruth | 4b6845c | 2014-03-04 12:46:06 +0000 | [diff] [blame] | 21 | #include "llvm/IR/LeakDetector.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 22 | #include "llvm/IR/Module.h" |
Torok Edwin | 6dd2730 | 2009-07-08 18:01:40 +0000 | [diff] [blame] | 23 | #include "llvm/Support/ErrorHandling.h" |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 24 | using namespace llvm; |
| 25 | |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | // GlobalValue Class |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
Jeffrey Yasskin | 091217b | 2010-01-27 20:34:15 +0000 | [diff] [blame] | 30 | bool GlobalValue::isMaterializable() const { |
Nick Lewycky | 780d2fe | 2010-02-15 21:27:20 +0000 | [diff] [blame] | 31 | return getParent() && getParent()->isMaterializable(this); |
Jeffrey Yasskin | 091217b | 2010-01-27 20:34:15 +0000 | [diff] [blame] | 32 | } |
| 33 | bool GlobalValue::isDematerializable() const { |
Nick Lewycky | 780d2fe | 2010-02-15 21:27:20 +0000 | [diff] [blame] | 34 | return getParent() && getParent()->isDematerializable(this); |
Jeffrey Yasskin | 091217b | 2010-01-27 20:34:15 +0000 | [diff] [blame] | 35 | } |
| 36 | bool GlobalValue::Materialize(std::string *ErrInfo) { |
| 37 | return getParent()->Materialize(this, ErrInfo); |
| 38 | } |
| 39 | void GlobalValue::Dematerialize() { |
| 40 | getParent()->Dematerialize(this); |
| 41 | } |
| 42 | |
Rafael Espindola | 339430f | 2014-02-25 23:25:17 +0000 | [diff] [blame] | 43 | const DataLayout *GlobalValue::getDataLayout() const { |
| 44 | return getParent()->getDataLayout(); |
| 45 | } |
| 46 | |
Misha Brukman | b1c9317 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 47 | /// Override destroyConstant to make sure it doesn't get called on |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 48 | /// GlobalValue's because they shouldn't be treated like other constants. |
Owen Anderson | 0d2de8c | 2009-06-20 00:24:58 +0000 | [diff] [blame] | 49 | void GlobalValue::destroyConstant() { |
Torok Edwin | fbcc663 | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 50 | llvm_unreachable("You can't GV->destroyConstant()!"); |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 51 | } |
Duncan Sands | dd7daee | 2008-05-26 19:58:59 +0000 | [diff] [blame] | 52 | |
| 53 | /// copyAttributesFrom - copy all additional attributes (those not needed to |
| 54 | /// create a GlobalValue) from the GlobalValue Src to this one. |
| 55 | void GlobalValue::copyAttributesFrom(const GlobalValue *Src) { |
| 56 | setAlignment(Src->getAlignment()); |
| 57 | setSection(Src->getSection()); |
| 58 | setVisibility(Src->getVisibility()); |
Chris Lattner | b1ed91f | 2011-07-09 17:41:24 +0000 | [diff] [blame] | 59 | setUnnamedAddr(Src->hasUnnamedAddr()); |
Rafael Espindola | 75ec01f | 2014-02-13 05:11:35 +0000 | [diff] [blame] | 60 | setDLLStorageClass(Src->getDLLStorageClass()); |
Duncan Sands | dd7daee | 2008-05-26 19:58:59 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Dan Gohman | 390914c | 2010-07-28 20:56:48 +0000 | [diff] [blame] | 63 | void GlobalValue::setAlignment(unsigned Align) { |
Rafael Espindola | 79c3ab7 | 2014-02-13 18:26:41 +0000 | [diff] [blame] | 64 | assert((!isa<GlobalAlias>(this) || !Align) && |
| 65 | "GlobalAlias should not have an alignment!"); |
Dan Gohman | 390914c | 2010-07-28 20:56:48 +0000 | [diff] [blame] | 66 | assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); |
| 67 | assert(Align <= MaximumAlignment && |
| 68 | "Alignment is greater than MaximumAlignment!"); |
| 69 | Alignment = Log2_32(Align) + 1; |
| 70 | assert(getAlignment() == Align && "Alignment representation error!"); |
| 71 | } |
Chris Lattner | 923053a | 2011-07-14 18:10:41 +0000 | [diff] [blame] | 72 | |
| 73 | bool GlobalValue::isDeclaration() const { |
Chris Lattner | 8561721 | 2011-07-14 18:12:44 +0000 | [diff] [blame] | 74 | // Globals are definitions if they have an initializer. |
Chris Lattner | 923053a | 2011-07-14 18:10:41 +0000 | [diff] [blame] | 75 | if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this)) |
| 76 | return GV->getNumOperands() == 0; |
| 77 | |
Chris Lattner | 8561721 | 2011-07-14 18:12:44 +0000 | [diff] [blame] | 78 | // Functions are definitions if they have a body. |
Chris Lattner | 923053a | 2011-07-14 18:10:41 +0000 | [diff] [blame] | 79 | if (const Function *F = dyn_cast<Function>(this)) |
| 80 | return F->empty(); |
Chris Lattner | 8561721 | 2011-07-14 18:12:44 +0000 | [diff] [blame] | 81 | |
Chris Lattner | 81210d2 | 2011-07-14 20:22:18 +0000 | [diff] [blame] | 82 | // Aliases are always definitions. |
| 83 | assert(isa<GlobalAlias>(this)); |
Chris Lattner | 923053a | 2011-07-14 18:10:41 +0000 | [diff] [blame] | 84 | return false; |
| 85 | } |
Dan Gohman | 390914c | 2010-07-28 20:56:48 +0000 | [diff] [blame] | 86 | |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 87 | //===----------------------------------------------------------------------===// |
| 88 | // GlobalVariable Implementation |
| 89 | //===----------------------------------------------------------------------===// |
| 90 | |
Hans Wennborg | cbe34b4 | 2012-06-23 11:37:03 +0000 | [diff] [blame] | 91 | GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link, |
Michael Gottesman | 4c4ffd7 | 2013-02-03 21:54:38 +0000 | [diff] [blame] | 92 | Constant *InitVal, |
| 93 | const Twine &Name, ThreadLocalMode TLMode, |
| 94 | unsigned AddressSpace, |
| 95 | bool isExternallyInitialized) |
Hans Wennborg | cbe34b4 | 2012-06-23 11:37:03 +0000 | [diff] [blame] | 96 | : GlobalValue(PointerType::get(Ty, AddressSpace), |
| 97 | Value::GlobalVariableVal, |
| 98 | OperandTraits<GlobalVariable>::op_begin(this), |
| 99 | InitVal != 0, Link, Name), |
Michael Gottesman | 4c4ffd7 | 2013-02-03 21:54:38 +0000 | [diff] [blame] | 100 | isConstantGlobal(constant), threadLocalMode(TLMode), |
| 101 | isExternallyInitializedConstant(isExternallyInitialized) { |
Chris Lattner | 5d1bc2c | 2005-01-29 00:35:33 +0000 | [diff] [blame] | 102 | if (InitVal) { |
| 103 | assert(InitVal->getType() == Ty && |
Alkis Evlogimenos | f45cc7a | 2004-08-05 11:28:34 +0000 | [diff] [blame] | 104 | "Initializer should be the same type as the GlobalVariable!"); |
Gabor Greif | 2d3024d | 2008-05-26 21:33:52 +0000 | [diff] [blame] | 105 | Op<0>() = InitVal; |
Alkis Evlogimenos | f45cc7a | 2004-08-05 11:28:34 +0000 | [diff] [blame] | 106 | } |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 107 | |
| 108 | LeakDetector::addGarbageObject(this); |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Chris Lattner | 229907c | 2011-07-18 04:54:35 +0000 | [diff] [blame] | 111 | GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant, |
Owen Anderson | b17f329 | 2009-07-08 19:03:57 +0000 | [diff] [blame] | 112 | LinkageTypes Link, Constant *InitVal, |
Daniel Dunbar | 4975db6 | 2009-07-25 04:41:11 +0000 | [diff] [blame] | 113 | const Twine &Name, |
Hans Wennborg | cbe34b4 | 2012-06-23 11:37:03 +0000 | [diff] [blame] | 114 | GlobalVariable *Before, ThreadLocalMode TLMode, |
Michael Gottesman | 4c4ffd7 | 2013-02-03 21:54:38 +0000 | [diff] [blame] | 115 | unsigned AddressSpace, |
| 116 | bool isExternallyInitialized) |
Hans Wennborg | ac9fb36 | 2012-06-23 12:14:23 +0000 | [diff] [blame] | 117 | : GlobalValue(PointerType::get(Ty, AddressSpace), |
Owen Anderson | 785c56c | 2009-07-08 23:50:31 +0000 | [diff] [blame] | 118 | Value::GlobalVariableVal, |
Gabor Greif | f6caff66 | 2008-05-10 08:32:32 +0000 | [diff] [blame] | 119 | OperandTraits<GlobalVariable>::op_begin(this), |
| 120 | InitVal != 0, Link, Name), |
Michael Gottesman | 4c4ffd7 | 2013-02-03 21:54:38 +0000 | [diff] [blame] | 121 | isConstantGlobal(constant), threadLocalMode(TLMode), |
| 122 | isExternallyInitializedConstant(isExternallyInitialized) { |
Chris Lattner | 87732cf | 2006-09-30 21:31:26 +0000 | [diff] [blame] | 123 | if (InitVal) { |
| 124 | assert(InitVal->getType() == Ty && |
| 125 | "Initializer should be the same type as the GlobalVariable!"); |
Gabor Greif | 2d3024d | 2008-05-26 21:33:52 +0000 | [diff] [blame] | 126 | Op<0>() = InitVal; |
Chris Lattner | 87732cf | 2006-09-30 21:31:26 +0000 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | LeakDetector::addGarbageObject(this); |
| 130 | |
| 131 | if (Before) |
| 132 | Before->getParent()->getGlobalList().insert(Before, this); |
Owen Anderson | b17f329 | 2009-07-08 19:03:57 +0000 | [diff] [blame] | 133 | else |
| 134 | M.getGlobalList().push_back(this); |
Chris Lattner | 87732cf | 2006-09-30 21:31:26 +0000 | [diff] [blame] | 135 | } |
| 136 | |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 137 | void GlobalVariable::setParent(Module *parent) { |
| 138 | if (getParent()) |
| 139 | LeakDetector::addGarbageObject(this); |
| 140 | Parent = parent; |
| 141 | if (getParent()) |
| 142 | LeakDetector::removeGarbageObject(this); |
| 143 | } |
| 144 | |
Chris Lattner | 02a71e7 | 2004-10-11 22:21:39 +0000 | [diff] [blame] | 145 | void GlobalVariable::removeFromParent() { |
| 146 | getParent()->getGlobalList().remove(this); |
| 147 | } |
| 148 | |
| 149 | void GlobalVariable::eraseFromParent() { |
| 150 | getParent()->getGlobalList().erase(this); |
| 151 | } |
| 152 | |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 153 | void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To, |
Chris Lattner | 7a1450d | 2005-10-04 18:13:04 +0000 | [diff] [blame] | 154 | Use *U) { |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 155 | // If you call this, then you better know this GVar has a constant |
| 156 | // initializer worth replacing. Enforce that here. |
Misha Brukman | b1c9317 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 157 | assert(getNumOperands() == 1 && |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 158 | "Attempt to replace uses of Constants on a GVar with no initializer"); |
| 159 | |
| 160 | // And, since you know it has an initializer, the From value better be |
| 161 | // the initializer :) |
| 162 | assert(getOperand(0) == From && |
| 163 | "Attempt to replace wrong constant initializer in GVar"); |
| 164 | |
| 165 | // And, you better have a constant for the replacement value |
| 166 | assert(isa<Constant>(To) && |
| 167 | "Attempt to replace GVar initializer with non-constant"); |
Misha Brukman | b1c9317 | 2005-04-21 23:48:37 +0000 | [diff] [blame] | 168 | |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 169 | // Okay, preconditions out of the way, replace the constant initializer. |
Chris Lattner | 37b570a | 2004-08-04 02:27:17 +0000 | [diff] [blame] | 170 | this->setOperand(0, cast<Constant>(To)); |
Reid Spencer | 3d169b1 | 2004-07-18 00:06:26 +0000 | [diff] [blame] | 171 | } |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 172 | |
Jeffrey Yasskin | 7c57c41 | 2009-11-17 00:43:13 +0000 | [diff] [blame] | 173 | void GlobalVariable::setInitializer(Constant *InitVal) { |
| 174 | if (InitVal == 0) { |
| 175 | if (hasInitializer()) { |
| 176 | Op<0>().set(0); |
| 177 | NumOperands = 0; |
| 178 | } |
| 179 | } else { |
| 180 | assert(InitVal->getType() == getType()->getElementType() && |
| 181 | "Initializer type must match GlobalVariable type"); |
| 182 | if (!hasInitializer()) |
| 183 | NumOperands = 1; |
| 184 | Op<0>().set(InitVal); |
| 185 | } |
| 186 | } |
| 187 | |
Duncan Sands | dd7daee | 2008-05-26 19:58:59 +0000 | [diff] [blame] | 188 | /// copyAttributesFrom - copy all additional attributes (those not needed to |
| 189 | /// create a GlobalVariable) from the GlobalVariable Src to this one. |
| 190 | void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) { |
| 191 | assert(isa<GlobalVariable>(Src) && "Expected a GlobalVariable!"); |
| 192 | GlobalValue::copyAttributesFrom(Src); |
| 193 | const GlobalVariable *SrcVar = cast<GlobalVariable>(Src); |
Hans Wennborg | 4a4be11 | 2014-02-10 17:13:56 +0000 | [diff] [blame] | 194 | setThreadLocalMode(SrcVar->getThreadLocalMode()); |
Duncan Sands | dd7daee | 2008-05-26 19:58:59 +0000 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 198 | //===----------------------------------------------------------------------===// |
| 199 | // GlobalAlias Implementation |
| 200 | //===----------------------------------------------------------------------===// |
| 201 | |
Chris Lattner | 229907c | 2011-07-18 04:54:35 +0000 | [diff] [blame] | 202 | GlobalAlias::GlobalAlias(Type *Ty, LinkageTypes Link, |
Daniel Dunbar | d43b86d | 2009-07-25 06:02:13 +0000 | [diff] [blame] | 203 | const Twine &Name, Constant* aliasee, |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 204 | Module *ParentModule) |
Gabor Greif | f6caff66 | 2008-05-10 08:32:32 +0000 | [diff] [blame] | 205 | : GlobalValue(Ty, Value::GlobalAliasVal, &Op<0>(), 1, Link, Name) { |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 206 | LeakDetector::addGarbageObject(this); |
| 207 | |
Anton Korobeynikov | b18f8f8 | 2007-04-28 13:45:00 +0000 | [diff] [blame] | 208 | if (aliasee) |
| 209 | assert(aliasee->getType() == Ty && "Alias and aliasee types should match!"); |
Gabor Greif | 2d3024d | 2008-05-26 21:33:52 +0000 | [diff] [blame] | 210 | Op<0>() = aliasee; |
Anton Korobeynikov | b18f8f8 | 2007-04-28 13:45:00 +0000 | [diff] [blame] | 211 | |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 212 | if (ParentModule) |
| 213 | ParentModule->getAliasList().push_back(this); |
| 214 | } |
| 215 | |
| 216 | void GlobalAlias::setParent(Module *parent) { |
| 217 | if (getParent()) |
| 218 | LeakDetector::addGarbageObject(this); |
| 219 | Parent = parent; |
| 220 | if (getParent()) |
| 221 | LeakDetector::removeGarbageObject(this); |
| 222 | } |
| 223 | |
| 224 | void GlobalAlias::removeFromParent() { |
| 225 | getParent()->getAliasList().remove(this); |
| 226 | } |
| 227 | |
| 228 | void GlobalAlias::eraseFromParent() { |
| 229 | getParent()->getAliasList().erase(this); |
| 230 | } |
| 231 | |
Chris Lattner | 7961781 | 2011-07-14 18:01:49 +0000 | [diff] [blame] | 232 | void GlobalAlias::setAliasee(Constant *Aliasee) { |
| 233 | assert((!Aliasee || Aliasee->getType() == getType()) && |
| 234 | "Alias and aliasee types should match!"); |
Anton Korobeynikov | 546ea7e | 2007-04-29 18:02:48 +0000 | [diff] [blame] | 235 | |
| 236 | setOperand(0, Aliasee); |
| 237 | } |
| 238 | |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 239 | GlobalValue *GlobalAlias::getAliasedGlobal() { |
| 240 | Constant *C = getAliasee(); |
Chris Lattner | 7961781 | 2011-07-14 18:01:49 +0000 | [diff] [blame] | 241 | if (C == 0) return 0; |
| 242 | |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 243 | if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) |
Chris Lattner | 7961781 | 2011-07-14 18:01:49 +0000 | [diff] [blame] | 244 | return GV; |
| 245 | |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 246 | ConstantExpr *CE = cast<ConstantExpr>(C); |
Matt Arsenault | 00436ea | 2014-01-02 20:55:01 +0000 | [diff] [blame] | 247 | assert((CE->getOpcode() == Instruction::BitCast || |
| 248 | CE->getOpcode() == Instruction::AddrSpaceCast || |
Chris Lattner | 7961781 | 2011-07-14 18:01:49 +0000 | [diff] [blame] | 249 | CE->getOpcode() == Instruction::GetElementPtr) && |
| 250 | "Unsupported aliasee"); |
| 251 | |
Jay Foad | 7f4cd9e | 2011-08-01 12:28:01 +0000 | [diff] [blame] | 252 | return cast<GlobalValue>(CE->getOperand(0)); |
Anton Korobeynikov | a97b694 | 2007-04-25 14:27:10 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 255 | GlobalValue *GlobalAlias::resolveAliasedGlobal(bool stopOnWeak) { |
| 256 | SmallPtrSet<GlobalValue*, 3> Visited; |
Anton Korobeynikov | da7db7d | 2008-03-11 22:28:56 +0000 | [diff] [blame] | 257 | |
Anton Korobeynikov | ac2c655 | 2008-09-09 18:23:48 +0000 | [diff] [blame] | 258 | // Check if we need to stop early. |
Duncan Sands | 715b289 | 2009-01-08 20:55:49 +0000 | [diff] [blame] | 259 | if (stopOnWeak && mayBeOverridden()) |
Anton Korobeynikov | ac2c655 | 2008-09-09 18:23:48 +0000 | [diff] [blame] | 260 | return this; |
| 261 | |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 262 | GlobalValue *GV = getAliasedGlobal(); |
Anton Korobeynikov | da7db7d | 2008-03-11 22:28:56 +0000 | [diff] [blame] | 263 | Visited.insert(GV); |
| 264 | |
Anton Korobeynikov | ac2c655 | 2008-09-09 18:23:48 +0000 | [diff] [blame] | 265 | // Iterate over aliasing chain, stopping on weak alias if necessary. |
Peter Collingbourne | f708c87 | 2013-08-19 23:13:33 +0000 | [diff] [blame] | 266 | while (GlobalAlias *GA = dyn_cast<GlobalAlias>(GV)) { |
Duncan Sands | 715b289 | 2009-01-08 20:55:49 +0000 | [diff] [blame] | 267 | if (stopOnWeak && GA->mayBeOverridden()) |
Anton Korobeynikov | ac2c655 | 2008-09-09 18:23:48 +0000 | [diff] [blame] | 268 | break; |
| 269 | |
Anton Korobeynikov | da7db7d | 2008-03-11 22:28:56 +0000 | [diff] [blame] | 270 | GV = GA->getAliasedGlobal(); |
| 271 | |
| 272 | if (!Visited.insert(GV)) |
Chris Lattner | 7961781 | 2011-07-14 18:01:49 +0000 | [diff] [blame] | 273 | return 0; |
Anton Korobeynikov | da7db7d | 2008-03-11 22:28:56 +0000 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | return GV; |
| 277 | } |