1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3 2# RUN: llc -run-pass=stack-coloring %s -o - | FileCheck %s 3 4# We do not expect any stack coloring remappings in this test case. 5# And then there should be no reason to drop the tbaa metadata on the 6# MOV8rm instruction, so we check that the tbaa info is kept. 7 8--- | 9 source_filename = "test_case.cc" 10 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 11 target triple = "x86_64-unknown-linux-gnu" 12 13 %struct.Agg = type { [3 x i8], [3 x i8] } 14 15 define i8 @main() { 16 %padding = alloca %struct.Agg, align 8 17 %agg = alloca %struct.Agg, align 8 18 %a2 = getelementptr inbounds %struct.Agg, ptr %agg, i64 0, i32 1 19 %a22 = getelementptr inbounds [3 x i8], ptr %a2, i64 0, i32 1 20 %t0 = load i8, ptr %a22, align 1, !tbaa !2 21 %tobool = icmp slt i8 %t0, 0 22 %t1 = load ptr, ptr %a2, align 8 23 %cond = select i1 %tobool, ptr %t1, ptr %a2 24 %add.ptr.i = getelementptr inbounds i8, ptr %cond, i64 16 25 %t2 = load i8, ptr %add.ptr.i, align 1, !tbaa !2 26 ret i8 %t2 27 } 28 29 !llvm.module.flags = !{!0} 30 !llvm.ident = !{!1} 31 32 !0 = !{i32 1, !"wchar_size", i32 4} 33 !1 = !{!"clang version 9.0.0"} 34 !2 = !{!3, !3, i64 0} 35 !3 = !{!"omnipotent char", !4, i64 0} 36 !4 = !{!"Simple C++ TBAA"} 37 38... 39--- 40name: main 41alignment: 16 42tracksRegLiveness: true 43stack: 44 - { id: 0, name: padding, type: default, offset: 0, size: 24, alignment: 16, 45 stack-id: default, callee-saved-register: '', callee-saved-restored: true, 46 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 47 - { id: 1, name: agg, type: default, offset: 0, size: 48, alignment: 16, 48 stack-id: default, callee-saved-register: '', callee-saved-restored: true, 49 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 50body: | 51 bb.0: 52 ; CHECK-LABEL: name: main 53 ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = nuw LEA64r %stack.1.agg, 1, $noreg, 24, $noreg 54 ; CHECK-NEXT: CMP8mi %stack.1.agg, 1, $noreg, 47, $noreg, 0, implicit-def $eflags :: (dereferenceable load (s8) from %ir.a22, !tbaa !2) 55 ; CHECK-NEXT: [[CMOV64rm:%[0-9]+]]:gr64 = CMOV64rm [[LEA64r]], %stack.1.agg, 1, $noreg, 24, $noreg, 8, implicit $eflags :: (dereferenceable load (s64) from %ir.a2) 56 ; CHECK-NEXT: [[MOV8rm:%[0-9]+]]:gr8 = MOV8rm killed [[CMOV64rm]], 1, $noreg, 16, $noreg :: (load (s8) from %ir.add.ptr.i, !tbaa !2) 57 ; CHECK-NEXT: $al = COPY [[MOV8rm]] 58 ; CHECK-NEXT: RET 0, $al 59 LIFETIME_START %stack.0.padding 60 LIFETIME_START %stack.1.agg 61 %8:gr64 = nuw LEA64r %stack.1.agg, 1, $noreg, 24, $noreg 62 CMP8mi %stack.1.agg, 1, $noreg, 47, $noreg, 0, implicit-def $eflags :: (dereferenceable load (s8) from %ir.a22, !tbaa !2) 63 %13:gr64 = CMOV64rm %8, %stack.1.agg, 1, $noreg, 24, $noreg, 8, implicit $eflags :: (dereferenceable load (s64) from %ir.a2) 64 %14:gr8 = MOV8rm killed %13, 1, $noreg, 16, $noreg :: (load (s8) from %ir.add.ptr.i, !tbaa !2) 65 $al = COPY %14 66 RET 0, $al 67 68... 69