diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-01-15 01:22:53 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-01-15 01:22:53 +0000 |
commit | 8dd938ed179267b2a3a5206c78e89530967f45a5 (patch) | |
tree | 717822f5eb6bb4634de0aa27f376262b71d85bae /test/Verifier | |
parent | 096d617796228293810cb0443c6617b33c5afdc5 (diff) | |
download | external_llvm-8dd938ed179267b2a3a5206c78e89530967f45a5.zip external_llvm-8dd938ed179267b2a3a5206c78e89530967f45a5.tar.gz external_llvm-8dd938ed179267b2a3a5206c78e89530967f45a5.tar.bz2 |
[IR] Add verifier support for llvm.module.flags.
- Also, update the LangRef documentation on module flags to match the
implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Verifier')
-rw-r--r-- | test/Verifier/module-flags-1.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Verifier/module-flags-1.ll b/test/Verifier/module-flags-1.ll new file mode 100644 index 0000000..eafb113 --- /dev/null +++ b/test/Verifier/module-flags-1.ll @@ -0,0 +1,37 @@ +; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s + +; Check that module flags are structurally correct. +; +; CHECK: incorrect number of operands in module flag +; CHECK: metadata !0 +!0 = metadata !{ i32 1 } +; CHECK: invalid behavior operand in module flag (expected constant integer) +; CHECK: metadata !"foo" +!1 = metadata !{ metadata !"foo", metadata !"foo", i32 42 } +; CHECK: invalid behavior operand in module flag (unexpected constant) +; CHECK: i32 999 +!2 = metadata !{ i32 999, metadata !"foo", i32 43 } +; CHECK: invalid ID operand in module flag (expected metadata string) +; CHECK: i32 1 +!3 = metadata !{ i32 1, i32 1, i32 44 } +; CHECK: invalid value for 'require' module flag (expected metadata pair) +; CHECK: i32 45 +!4 = metadata !{ i32 3, metadata !"bla", i32 45 } +; CHECK: invalid value for 'require' module flag (expected metadata pair) +; CHECK: metadata ! +!5 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 46 } } +; CHECK: invalid value for 'require' module flag (first value operand should be a string) +; CHECK: i32 47 +!6 = metadata !{ i32 3, metadata !"bla", metadata !{ i32 47, i32 48 } } + +; Check that module flags only have unique IDs. +; +; CHECK: module flag identifiers must be unique (or of 'require' type) +!7 = metadata !{ i32 1, metadata !"foo", i32 49 } +!8 = metadata !{ i32 2, metadata !"foo", i32 50 } +; CHECK-NOT: module flag identifiers must be unique +!9 = metadata !{ i32 2, metadata !"bar", i32 51 } +!10 = metadata !{ i32 3, metadata !"bar", i32 51 } + +!llvm.module.flags = !{ + !0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10 } |