111 lines · plain
1; RUN: llc < %s -frame-pointer=all -mtriple x86_64-apple-darwin11 -mcpu corei7 -emit-compact-unwind-non-canonical=true | FileCheck -check-prefix=ASM %s2; RUN: llc < %s -frame-pointer=all -mtriple x86_64-apple-darwin11 -mcpu corei7 -filetype=obj -emit-compact-unwind-non-canonical=true -o - \3; RUN: | llvm-objdump --triple=x86_64-apple-darwin11 --unwind-info - \4; RUN: | FileCheck -check-prefix=CU %s5; RUN: llc < %s -frame-pointer=all -mtriple x86_64-apple-darwin11 -mcpu corei7 -emit-compact-unwind-non-canonical=true \6; RUN: | llvm-mc -triple x86_64-apple-darwin11 -filetype=obj -emit-compact-unwind-non-canonical=true -o - \7; RUN: | llvm-objdump --triple=x86_64-apple-darwin11 --unwind-info - \8; RUN: | FileCheck -check-prefix=FROM-ASM %s9 10; RUN: llc < %s -mtriple x86_64-apple-macosx10.8.0 -mcpu corei7 -filetype=obj -emit-compact-unwind-non-canonical=true -o - \11; RUN: | llvm-objdump --triple=x86_64-apple-macosx10.8.0 --unwind-info - \12; RUN: | FileCheck -check-prefix=NOFP-CU %s13; RUN: llc < %s -mtriple x86_64-apple-darwin11 -mcpu corei7 \14; RUN: | llvm-mc -triple x86_64-apple-darwin11 -filetype=obj -emit-compact-unwind-non-canonical=true -o - \15; RUN: | llvm-objdump --triple=x86_64-apple-darwin11 --unwind-info - \16; RUN: | FileCheck -check-prefix=NOFP-FROM-ASM %s17 18%ty = type { ptr }19 20@gv = external global i3221 22; This is aligning the stack with a push of a random register.23; ASM: pushq %rax24 25; Even though we can't encode %rax into the compact unwind, We still want to be26; able to generate a compact unwind encoding in this particular case.27 28; CU: Contents of __compact_unwind section:29; CU-NEXT: Entry at offset 0x0:30; CU-NEXT: start: 0x0 _test031; CU-NEXT: length: 0x1e32; CU-NEXT: compact encoding: 0x0101000133 34; FROM-ASM: Contents of __compact_unwind section:35; FROM-ASM-NEXT: Entry at offset 0x0:36; FROM-ASM-NEXT: start: 0x0 _test037; FROM-ASM-NEXT: length: 0x1e38; FROM-ASM-NEXT: compact encoding: 0x0101000139 40define ptr @test0(i64 %size) {41 %addr = alloca i64, align 842 %tmp20 = load i32, ptr @gv, align 443 %tmp21 = call i32 @bar()44 %tmp25 = load i64, ptr %addr, align 845 %tmp26 = inttoptr i64 %tmp25 to ptr46 %tmp34 = load ptr, ptr %tmp26, align 847 %tmp35 = getelementptr inbounds i8, ptr %tmp34, i64 %size48 store ptr %tmp35, ptr %tmp26, align 849 ret ptr null50}51 52declare i32 @bar()53 54%"struct.dyld::MappedRanges" = type { [400 x %struct.anon], ptr }55%struct.anon = type { ptr, i64, i64 }56%class.ImageLoader = type { ptr, ptr, ptr, i32, i64, i64, i32, i32, ptr, i16, i16, [4 x i8] }57%"struct.ImageLoader::recursive_lock" = type { i32, i32 }58 59@G1 = external hidden global %"struct.dyld::MappedRanges", align 860 61declare void @OSMemoryBarrier() optsize62 63; Test the code below uses UNWIND_X86_64_MODE_STACK_IMMD compact unwind64; encoding.65 66; NOFP-CU: Entry at offset 0x20:67; NOFP-CU-NEXT: start: 0x1d _test168; NOFP-CU-NEXT: length: 0x4469; NOFP-CU-NEXT: compact encoding: 0x02040c0a70 71; NOFP-FROM-ASM: Entry at offset 0x20:72; NOFP-FROM-ASM-NEXT: start: 0x1d _test173; NOFP-FROM-ASM-NEXT: length: 0x4474; NOFP-FROM-ASM-NEXT: compact encoding: 0x02040c0a75 76define void @test1(ptr %image) optsize ssp uwtable {77entry:78 br label %for.cond1.preheader79 80for.cond1.preheader: ; preds = %for.inc10, %entry81 %p.019 = phi ptr [ @G1, %entry ], [ %1, %for.inc10 ]82 br label %for.body383 84for.body3: ; preds = %for.inc, %for.cond1.preheader85 %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]86 %image4 = getelementptr inbounds %"struct.dyld::MappedRanges", ptr %p.019, i64 0, i32 0, i64 %indvars.iv, i32 087 %0 = load ptr, ptr %image4, align 888 %cmp5 = icmp eq ptr %0, %image89 br i1 %cmp5, label %if.then, label %for.inc90 91if.then: ; preds = %for.body392 tail call void @OSMemoryBarrier() optsize93 store ptr null, ptr %image4, align 894 br label %for.inc95 96for.inc: ; preds = %if.then, %for.body397 %indvars.iv.next = add i64 %indvars.iv, 198 %lftr.wideiv = trunc i64 %indvars.iv.next to i3299 %exitcond = icmp eq i32 %lftr.wideiv, 400100 br i1 %exitcond, label %for.inc10, label %for.body3101 102for.inc10: ; preds = %for.inc103 %next = getelementptr inbounds %"struct.dyld::MappedRanges", ptr %p.019, i64 0, i32 1104 %1 = load ptr, ptr %next, align 8105 %cmp = icmp eq ptr %1, null106 br i1 %cmp, label %for.end11, label %for.cond1.preheader107 108for.end11: ; preds = %for.inc10109 ret void110}111