|
| 1 | +; Test file to check shrink-wrap pass |
| 2 | + |
| 3 | +; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-ibm-aix-xcoff -mcpu=pwr9 | FileCheck %s --check-prefixes=POWERPC32-AIX |
| 4 | +; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff -mcpu=pwr9 | FileCheck %s --check-prefixes=POWERPC64-AIX |
| 5 | + |
| 6 | +@.str = private unnamed_addr constant [50 x i8] c"parent_frame_pointer > __builtin_frame_address(0)\00", align 1 |
| 7 | +@.str.1 = private unnamed_addr constant [8 x i8] c"bad.cpp\00", align 1 |
| 8 | + |
| 9 | +; Function Attrs: mustprogress noinline nounwind |
| 10 | +define void @_Z3fooPv(ptr noundef readnone %parent_frame_pointer) local_unnamed_addr #0 { |
| 11 | + |
| 12 | +; POWERPC32-AIX-LABEL: ._Z3fooPv: |
| 13 | +; POWERPC32-AIX: # %bb.0: |
| 14 | +; POWERPC32-AIX-NEXT: mflr 0 |
| 15 | +; POWERPC32-AIX-NEXT: stwu 1, -64(1) |
| 16 | +; POWERPC32-AIX-NEXT: cmplw 3, 1 |
| 17 | +; POWERPC32-AIX-NEXT: stw 0, 72(1) |
| 18 | +; POWERPC32-AIX-NEXT: ble- 0, L..BB0_2 |
| 19 | +; POWERPC32-AIX-NEXT: # %bb.1: |
| 20 | +; POWERPC32-AIX-NEXT: addi 1, 1, 64 |
| 21 | +; POWERPC32-AIX-NEXT: lwz 0, 8(1) |
| 22 | +; POWERPC32-AIX-NEXT: mtlr 0 |
| 23 | +; POWERPC32-AIX-NEXT: blr |
| 24 | +; POWERPC32-AIX-NEXT: L..BB0_2: |
| 25 | +; POWERPC32-AIX-NEXT: lwz 4, L..C0(2) |
| 26 | +; POWERPC32-AIX-NEXT: li 5, 6 |
| 27 | +; POWERPC32-AIX-NEXT: addi 3, 4, 8 |
| 28 | +; POWERPC32-AIX-NEXT: bl .__assert[PR] |
| 29 | +; POWERPC32-AIX-NEXT: nop |
| 30 | + |
| 31 | +; POWERPC64-AIX-LABEL: ._Z3fooPv: |
| 32 | +; POWERPC64-AIX: # %bb.0: |
| 33 | +; POWERPC64-AIX-NEXT: mflr 0 |
| 34 | +; POWERPC64-AIX-NEXT: stdu 1, -112(1) |
| 35 | +; POWERPC64-AIX-NEXT: cmpld 3, 1 |
| 36 | +; POWERPC64-AIX-NEXT: std 0, 128(1) |
| 37 | +; POWERPC64-AIX-NEXT: ble- 0, L..BB0_2 |
| 38 | +; POWERPC64-AIX-NEXT: # %bb.1: |
| 39 | +; POWERPC64-AIX-NEXT: addi 1, 1, 112 |
| 40 | +; POWERPC64-AIX-NEXT: ld 0, 16(1) |
| 41 | +; POWERPC64-AIX-NEXT: mtlr 0 |
| 42 | +; POWERPC64-AIX-NEXT: blr |
| 43 | +; POWERPC64-AIX-NEXT: L..BB0_2: |
| 44 | +; POWERPC64-AIX-NEXT: ld 4, L..C0(2) |
| 45 | +; POWERPC64-AIX-NEXT: li 5, 6 |
| 46 | +; POWERPC64-AIX-NEXT: addi 3, 4, 8 |
| 47 | +; POWERPC64-AIX-NEXT: bl .__assert[PR] |
| 48 | +; POWERPC64-AIX-NEXT: nop |
| 49 | + |
| 50 | +entry: |
| 51 | + %0 = tail call ptr @llvm.frameaddress.p0(i32 0) |
| 52 | + %cmp = icmp ugt ptr %parent_frame_pointer, %0 |
| 53 | + br i1 %cmp, label %cond.end, label %cond.false |
| 54 | + |
| 55 | +cond.false: ; preds = %entry |
| 56 | + tail call void @__assert(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 6) #4 |
| 57 | + unreachable |
| 58 | + |
| 59 | +cond.end: ; preds = %entry |
| 60 | + ret void |
| 61 | +} |
| 62 | + |
| 63 | +; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
| 64 | +declare ptr @llvm.frameaddress.p0(i32 immarg) #1 |
| 65 | + |
| 66 | +; Function Attrs: noreturn nounwind |
| 67 | +declare void @__assert(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2 |
| 68 | + |
| 69 | +; Function Attrs: mustprogress norecurse nounwind |
| 70 | +define noundef i32 @main() local_unnamed_addr #3 { |
| 71 | +; POWERPC32-AIX-LABEL: .main: |
| 72 | +; POWERPC32-AIX: # %bb.0: |
| 73 | +; POWERPC32-AIX-NEXT: mflr 0 |
| 74 | +; POWERPC32-AIX-NEXT: stwu 1, -64(1) |
| 75 | +; POWERPC32-AIX-NEXT: mr 3, 1 |
| 76 | +; POWERPC32-AIX-NEXT: stw 0, 72(1) |
| 77 | +; POWERPC32-AIX-NEXT: bl ._Z3fooPv |
| 78 | +; POWERPC32-AIX-NEXT: nop |
| 79 | +; POWERPC32-AIX-NEXT: li 3, 0 |
| 80 | +; POWERPC32-AIX-NEXT: addi 1, 1, 64 |
| 81 | +; POWERPC32-AIX-NEXT: lwz 0, 8(1) |
| 82 | +; POWERPC32-AIX-NEXT: mtlr 0 |
| 83 | +; POWERPC32-AIX-NEXT: blr |
| 84 | + |
| 85 | +; POWERPC64-AIX-LABEL: .main: |
| 86 | +; POWERPC64-AIX: # %bb.0: |
| 87 | +; POWERPC64-AIX-NEXT: mflr 0 |
| 88 | +; POWERPC64-AIX-NEXT: stdu 1, -112(1) |
| 89 | +; POWERPC64-AIX-NEXT: mr 3, 1 |
| 90 | +; POWERPC64-AIX-NEXT: std 0, 128(1) |
| 91 | +; POWERPC64-AIX-NEXT: bl ._Z3fooPv |
| 92 | +; POWERPC64-AIX-NEXT: nop |
| 93 | +; POWERPC64-AIX-NEXT: li 3, 0 |
| 94 | +; POWERPC64-AIX-NEXT: addi 1, 1, 112 |
| 95 | +; POWERPC64-AIX-NEXT: ld 0, 16(1) |
| 96 | +; POWERPC64-AIX-NEXT: mtlr 0 |
| 97 | +; POWERPC64-AIX-NEXT: blr |
| 98 | + |
| 99 | +entry: |
| 100 | + %0 = tail call ptr @llvm.frameaddress.p0(i32 0) |
| 101 | + tail call void @_Z3fooPv(ptr noundef %0) |
| 102 | + ret i32 0 |
| 103 | +} |
0 commit comments