1 ; RUN: llc -mattr=harden-sls-ret -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefixes=CHECK,RET
2 ; RUN: llc -mattr=harden-sls-ijmp -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefixes=CHECK,IJMP
4 define dso_local i32 @double_return(i32 %a, i32 %b) local_unnamed_addr {
5 ; CHECK-LABEL: double_return:
15 %cmp = icmp sgt i32 %a, 0
16 br i1 %cmp, label %if.then, label %if.else
18 if.then: ; preds = %entry
19 %div = sdiv i32 %a, %b
22 if.else: ; preds = %entry
23 %div1 = sdiv i32 %b, %a
27 @__const.indirect_branch.ptr = private unnamed_addr constant [2 x ptr] [ptr blockaddress(@indirect_branch, %return), ptr blockaddress(@indirect_branch, %l2)], align 8
29 ; Function Attrs: norecurse nounwind readnone
30 define dso_local i32 @indirect_branch(i32 %a, i32 %b, i32 %i) {
31 ; CHECK-LABEL: indirect_branch:
42 %idxprom = sext i32 %i to i64
43 %arrayidx = getelementptr inbounds [2 x ptr], ptr @__const.indirect_branch.ptr, i64 0, i64 %idxprom
44 %0 = load ptr, ptr %arrayidx, align 8
45 indirectbr ptr %0, [label %return, label %l2]
50 return: ; preds = %entry, %l2
51 %retval.0 = phi i32 [ 1, %l2 ], [ 0, %entry ]
55 define i32 @asmgoto() {
56 ; CHECK-LABEL: asmgoto:
57 ; CHECK: # %bb.0: # %entry
67 callbr void asm sideeffect "jmp $0", "!i"()
68 to label %asm.fallthrough [label %d]
69 ; The asm goto above produces a direct branch:
71 asm.fallthrough: ; preds = %entry
74 d: ; preds = %asm.fallthrough, %entry
78 define void @bar(ptr %0) {
88 declare dso_local void @foo()
90 define dso_local void @bar2() {