[llvm-commits] CVS: llvm/lib/VMCore/Globals.cpp

Chris Lattner sabre at nondot.org
Sat May 5 16:49:20 PDT 2007



Changes in directory llvm/lib/VMCore:

Globals.cpp updated: 1.24 -> 1.25
---
Log message:

handle gep aliasee


---
Diffs of the changes:  (+4 -3)

 Globals.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.24 llvm/lib/VMCore/Globals.cpp:1.25
--- llvm/lib/VMCore/Globals.cpp:1.24	Thu May  3 17:09:21 2007
+++ llvm/lib/VMCore/Globals.cpp	Sat May  5 18:49:02 2007
@@ -210,7 +210,7 @@
   setOperand(0, Aliasee);
 }
 
-const GlobalValue *GlobalAlias::getAliasedGlobal() const  {
+const GlobalValue *GlobalAlias::getAliasedGlobal() const {
   const Constant *C = getAliasee();
   if (C) {
     if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
@@ -218,8 +218,9 @@
     else {
       const ConstantExpr *CE = 0;
       if ((CE = dyn_cast<ConstantExpr>(C)) &&
-          (CE->getOpcode() == Instruction::BitCast))
-        return cast<GlobalValue>(CE->getOperand(0));
+          (CE->getOpcode() == Instruction::BitCast || 
+           CE->getOpcode() == Instruction::GetElementPtr))
+        return dyn_cast<GlobalValue>(CE->getOperand(0));
       else
         assert(0 && "Unsupported aliasee");
     }






More information about the llvm-commits mailing list