diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-08-08 17:00:09 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-08-08 17:00:09 +0000 |
commit | 1df7059150a1f5e8c2681eb93c5904ab3f844096 (patch) | |
tree | a4deac594bb353d71072368d78b9710fd6b30f71 /llvm/test/CodeGen/Hexagon | |
parent | 935f3b70fe36528a59000808a327c801cf15eeea (diff) | |
download | bcm5719-llvm-1df7059150a1f5e8c2681eb93c5904ab3f844096.tar.gz bcm5719-llvm-1df7059150a1f5e8c2681eb93c5904ab3f844096.zip |
[Hexagon] Diagnose misaligned absolute loads and stores
Differential Revision: https://reviews.llvm.org/D50405
llvm-svn: 339272
Diffstat (limited to 'llvm/test/CodeGen/Hexagon')
-rw-r--r-- | llvm/test/CodeGen/Hexagon/misaligned-const-load.ll | 38 | ||||
-rw-r--r-- | llvm/test/CodeGen/Hexagon/misaligned-const-store.ll | 38 |
2 files changed, 76 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Hexagon/misaligned-const-load.ll b/llvm/test/CodeGen/Hexagon/misaligned-const-load.ll new file mode 100644 index 00000000000..0a437964cc7 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/misaligned-const-load.ll @@ -0,0 +1,38 @@ +; RUN: not llc -march=hexagon < %s 2>&1 | FileCheck %s + +; Check that the misaligned load is diagnosed. +; CHECK: LLVM ERROR: Misaligned constant address: 0x00012345 has alignment 1, but the memory access requires 4, at misaligned-const-load.c:2:10 + +target triple = "hexagon" + +define i32 @bad_load() #0 !dbg !10 { +entry: + %0 = load i32, i32* inttoptr (i32 74565 to i32*), align 4, !dbg !13, !tbaa !14 + ret i32 %0, !dbg !18 +} + +attributes #0 = { norecurse nounwind readonly "target-cpu"="hexagonv60" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!6, !7, !8} +!llvm.ident = !{!9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (http://llvm.org/git/clang.git 3fb90d137ea16e5c3a4580b9db5fd18d93df1a90) (http://llvm.org/git/llvm.git daf385e5698c00fdd693fac736acc96b95ccccd3)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3) +!1 = !DIFile(filename: "misaligned-const-load.c", directory: "/test") +!2 = !{} +!3 = !{!4} +!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 32) +!5 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) +!6 = !{i32 2, !"Dwarf Version", i32 4} +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !{i32 1, !"wchar_size", i32 4} +!9 = !{!"clang version 8.0.0 (http://llvm.org/git/clang.git 3fb90d137ea16e5c3a4580b9db5fd18d93df1a90) (http://llvm.org/git/llvm.git daf385e5698c00fdd693fac736acc96b95ccccd3)"} +!10 = distinct !DISubprogram(name: "bad_load", scope: !1, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2) +!11 = !DISubroutineType(types: !12) +!12 = !{!5} +!13 = !DILocation(line: 2, column: 10, scope: !10) +!14 = !{!15, !15, i64 0} +!15 = !{!"int", !16, i64 0} +!16 = !{!"omnipotent char", !17, i64 0} +!17 = !{!"Simple C/C++ TBAA"} +!18 = !DILocation(line: 2, column: 3, scope: !10) diff --git a/llvm/test/CodeGen/Hexagon/misaligned-const-store.ll b/llvm/test/CodeGen/Hexagon/misaligned-const-store.ll new file mode 100644 index 00000000000..b24cd778449 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/misaligned-const-store.ll @@ -0,0 +1,38 @@ +; RUN: not llc -march=hexagon < %s 2>&1 | FileCheck %s + +; Check that the misaligned store is diagnosed. +; CHECK: LLVM ERROR: Misaligned constant address: 0x00012345 has alignment 1, but the memory access requires 4, at misaligned-const-store.c:2:10 + +target triple = "hexagon" + +define void @bad_store(i32 %a0) #0 !dbg !10 { +entry: + store i32 %a0, i32* inttoptr (i32 74565 to i32*), align 4, !dbg !13, !tbaa !14 + ret void, !dbg !18 +} + +attributes #0 = { norecurse nounwind readonly "target-cpu"="hexagonv60" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!6, !7, !8} +!llvm.ident = !{!9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (http://llvm.org/git/clang.git 3fb90d137ea16e5c3a4580b9db5fd18d93df1a90) (http://llvm.org/git/llvm.git daf385e5698c00fdd693fac736acc96b95ccccd3)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3) +!1 = !DIFile(filename: "misaligned-const-store.c", directory: "/test") +!2 = !{} +!3 = !{!4} +!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 32) +!5 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) +!6 = !{i32 2, !"Dwarf Version", i32 4} +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !{i32 1, !"wchar_size", i32 4} +!9 = !{!"clang version 8.0.0 (http://llvm.org/git/clang.git 3fb90d137ea16e5c3a4580b9db5fd18d93df1a90) (http://llvm.org/git/llvm.git daf385e5698c00fdd693fac736acc96b95ccccd3)"} +!10 = distinct !DISubprogram(name: "bad_store", scope: !1, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2) +!11 = !DISubroutineType(types: !12) +!12 = !{!5} +!13 = !DILocation(line: 2, column: 10, scope: !10) +!14 = !{!15, !15, i64 0} +!15 = !{!"int", !16, i64 0} +!16 = !{!"omnipotent char", !17, i64 0} +!17 = !{!"Simple C/C++ TBAA"} +!18 = !DILocation(line: 2, column: 3, scope: !10) |