1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Transforms/Util/store-first-op.ll
Sanjoy Das a0e8011216 [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
2016-12-11 20:07:15 +00:00

38 lines
1.8 KiB
LLVM

; RUN: opt -instcombine -S %s | FileCheck %s
%foo = type { i8 }
; Function Attrs: nounwind uwtable
define void @_ZN4llvm13ScaledNumbers10multiply64Emm() {
entry:
%getU = alloca %foo, align 1
; This is supposed to make sure that the declare conversion, does not accidentally think the store OF
; %getU is a store TO %getU. There are valid reasons to have an llvm.dbg.value here, but if the pass
; is changed to emit such, a more specific check should be added to make sure that any llvm.dbg.value
; is correct.
; CHECK-NOT: @llvm.dbg.value(metadata %foo* %getU
call void @llvm.dbg.declare(metadata %foo* %getU, metadata !3, metadata !6), !dbg !7
store %foo* %getU, %foo** undef, align 8, !tbaa !8
unreachable
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257597)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
!1 = !DIFile(filename: "none", directory: ".")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !DILocalVariable(name: "getU", scope: !4, file: !1, line: 25, type: !5)
!4 = distinct !DISubprogram(name: "multiply64", linkageName: "_ZN4llvm13ScaledNumbers10multiply64Emm", scope: null, file: !1, line: 22, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
!5 = !DICompositeType(tag: DW_TAG_class_type, scope: !4, file: !1, line: 25, size: 8, align: 8)
!6 = !DIExpression()
!7 = !DILocation(line: 25, column: 8, scope: !4)
!8 = !{!10, !10, i64 0}
!9 = !{i64 0}
!10 = !{!"scalar type", !9}