diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-12-11 20:07:15 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-12-11 20:07:15 +0000 |
| commit | 3336f681e3f548e082d363b848edaeb3e0fcb644 (patch) | |
| tree | 36736acde3a80e22994651d343fe2d3435179107 /llvm/test/Transforms/SimplifyCFG | |
| parent | 81ed3499cdf61dcf3cfb426de24f4f406bd04b0f (diff) | |
| download | bcm5719-llvm-3336f681e3f548e082d363b848edaeb3e0fcb644.tar.gz bcm5719-llvm-3336f681e3f548e082d363b848edaeb3e0fcb644.zip | |
[Verifier] Add verification for TBAA metadata
Summary:
This change adds some verification in the IR verifier around struct path
TBAA metadata.
Other than some basic sanity checks (e.g. we get constant integers where
we expect constant integers), this checks:
- That by the time an struct access tuple `(base-type, offset)` is
"reduced" to a scalar base type, the offset is `0`. For instance, in
C++ you can't start from, say `("struct-a", 16)`, and end up with
`("int", 4)` -- by the time the base type is `"int"`, the offset
better be zero. In particular, a variant of this invariant is needed
for `llvm::getMostGenericTBAA` to be correct.
- That there are no cycles in a struct path.
- That struct type nodes have their offsets listed in an ascending
order.
- That when generating the struct access path, you eventually reach the
access type listed in the tbaa tag node.
Reviewers: dexonsmith, chandlerc, reames, mehdi_amini, manmanren
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D26438
llvm-svn: 289402
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/basictest.ll | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/basictest.ll b/llvm/test/Transforms/SimplifyCFG/basictest.ll index 686a535a32d..f82cbd71c29 100644 --- a/llvm/test/Transforms/SimplifyCFG/basictest.ll +++ b/llvm/test/Transforms/SimplifyCFG/basictest.ll @@ -106,7 +106,7 @@ bb0: %tmp1 = icmp eq i8 %tmp, 0 br i1 %tmp1, label %bb2, label %bb1 bb1: - %tmp3 = load i8, i8* %r, align 1, !range !2, !tbaa !1, !dbg !5 + %tmp3 = load i8, i8* %r, align 1, !range !2, !tbaa !10, !dbg !5 %tmp4 = icmp eq i8 %tmp3, 1 br i1 %tmp4, label %bb2, label %bb3 bb2: @@ -120,7 +120,7 @@ declare i8 @test6g(i8*) !llvm.dbg.cu = !{!3} !llvm.module.flags = !{!8, !9} -!0 = !{!1, !1, i64 0} +!0 = !{!10, !10, i64 0} !1 = !{!"foo"} !2 = !{i8 0, i8 2} !3 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !4) @@ -130,3 +130,4 @@ declare i8 @test6g(i8*) !7 = !DIFile(filename: "foo.c", directory: "/") !8 = !{i32 2, !"Dwarf Version", i32 2} !9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{!"scalar type", !1} |

