76 lines · plain
1; RUN: llc -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefix=BTI2; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel < %s | FileCheck %s --check-prefix=BTI3; RUN: llc -mtriple=aarch64-none-linux-gnu -fast-isel < %s | FileCheck %s --check-prefix=BTI4; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+harden-sls-blr< %s | FileCheck %s --check-prefix=BTISLS5; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel -mattr=+harden-sls-blr< %s | FileCheck %s --check-prefix=BTISLS6; RUN: llc -mtriple=aarch64-none-linux-gnu -fast-isel -mattr=+harden-sls-blr< %s | FileCheck %s --check-prefix=BTISLS7; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+no-bti-at-return-twice < %s | \8; RUN: FileCheck %s --check-prefix=NOBTI9; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel -mattr=+no-bti-at-return-twice < %s | \10; RUN: FileCheck %s --check-prefix=NOBTI11; RUN: llc -mtriple=aarch64-none-linux-gnu -fast-isel -mattr=+no-bti-at-return-twice < %s | \12; RUN: FileCheck %s --check-prefix=NOBTI13 14; C source15; --------16; extern int setjmp(ptr);17; extern void notsetjmp(void);18;19; void bbb(void) {20; setjmp(0);21; setjmp(0); // With the attributes removed.22; int (*fnptr)(ptr) = setjmp;23; fnptr(0); // With attributes added.24; notsetjmp();25; }26 27define void @bbb() #1 {28; BTI-LABEL: bbb:29; BTI: bl setjmp30; BTI-NEXT: hint #3631; BTI: bl setjmp32; BTI-NEXT: hint #3633; BTI: blr x{{[0-9]+}}34; BTI-NEXT: hint #3635; BTI: bl notsetjmp36; BTI-NOT: hint #3637 38; BTISLS-LABEL: bbb:39; BTISLS: bl setjmp40; BTISLS-NEXT: hint #3641; BTISLS: bl setjmp42; BTISLS-NEXT: hint #3643; BTISLS: bl __llvm_slsblr_thunk_x{{[0-9]+}}44; BTISLS-NEXT: hint #3645; BTISLS: bl notsetjmp46; BTISLS-NOT: hint #3647 48; NOBTI-LABEL: bbb:49; NOBTI: bl setjmp50; NOBTI-NOT: hint #3651; NOBTI: bl setjmp52; NOBTI-NOT: hint #3653; NOBTI: blr x{{[0-9]+}}54; NOBTI-NOT: hint #3655; NOBTI: bl notsetjmp56; NOBTI-NOT: hint #3657entry:58 %fnptr = alloca ptr, align 859 ; The frontend may apply attributes to the call, but it doesn't have to. We60 ; should be looking at the call base, which looks past that to the called function.61 %call = call i32 @setjmp(ptr noundef null) #062 %call1 = call i32 @setjmp(ptr noundef null)63 store ptr @setjmp, ptr %fnptr, align 864 %0 = load ptr, ptr %fnptr, align 865 ; Clang does not attach the attribute here but if it did, it should work.66 %call2 = call i32 %0(ptr noundef null) #067 call void @notsetjmp()68 ret void69}70 71declare i32 @setjmp(ptr noundef) #072declare void @notsetjmp()73 74attributes #0 = { returns_twice }75attributes #1 = { "branch-target-enforcement" }76