summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-25 21:26:00 +0000
committerChris Lattner <sabre@nondot.org>2009-04-25 21:26:00 +0000
commit4c73d7a9b804e12dbb2d41d63cfe96b2b9ec6cf2 (patch)
treecd243d7a783bb2db40fbec98fdf578b2f1f8e497 /llvm
parentcde89e48b23f80899225e91b3eedf3b6e7388d8d (diff)
downloadbcm5719-llvm-4c73d7a9b804e12dbb2d41d63cfe96b2b9ec6cf2.tar.gz
bcm5719-llvm-4c73d7a9b804e12dbb2d41d63cfe96b2b9ec6cf2.zip
testcase and asmparser fix for PR4066
llvm-svn: 70080
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp7
-rw-r--r--llvm/test/Assembler/2009-04-25-AliasGEP.ll8
2 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index af309926afd..a2edf050508 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -357,7 +357,9 @@ bool LLParser::ParseNamedGlobal() {
/// ParseAlias:
/// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee
/// Aliasee
-/// ::= TypeAndValue | 'bitcast' '(' TypeAndValue 'to' Type ')'
+/// ::= TypeAndValue
+/// ::= 'bitcast' '(' TypeAndValue 'to' Type ')'
+/// ::= 'getelementptr' '(' ... ')'
///
/// Everything through visibility has already been parsed.
///
@@ -379,7 +381,8 @@ bool LLParser::ParseAlias(const std::string &Name, LocTy NameLoc,
Constant *Aliasee;
LocTy AliaseeLoc = Lex.getLoc();
- if (Lex.getKind() != lltok::kw_bitcast) {
+ if (Lex.getKind() != lltok::kw_bitcast &&
+ Lex.getKind() != lltok::kw_getelementptr) {
if (ParseGlobalTypeAndValue(Aliasee)) return true;
} else {
// The bitcast dest type is not present, it is implied by the dest type.
diff --git a/llvm/test/Assembler/2009-04-25-AliasGEP.ll b/llvm/test/Assembler/2009-04-25-AliasGEP.ll
new file mode 100644
index 00000000000..6d07208defe
--- /dev/null
+++ b/llvm/test/Assembler/2009-04-25-AliasGEP.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis
+; PR4066
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.i2c_device_id = type { }
+@w83l785ts_id = internal constant [0 x %struct.i2c_device_id] zeroinitializer, align 1 ; <[0 x %struct.i2c_device_id]*> [#uses=1]
+
+@__mod_i2c_device_table = alias getelementptr ([0 x %struct.i2c_device_id]* @w83l785ts_id, i32 0, i32 0) ; <%struct.i2c_device_id*> [#uses=0]
OpenPOWER on IntegriCloud