Debian Codegraph @

llvm/test/Transforms/SafeStack/X86/cast.ll

raw
1 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3 ; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
5
6 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
7
8 ; PtrToInt/IntToPtr Cast
9
10 define void @IntToPtr() nounwind uwtable safestack {
11 entry:
12 ; CHECK-LABEL: @IntToPtr(
13 ; CHECK-NOT: __safestack_unsafe_stack_ptr
14 ; CHECK: ret void
15 %a = alloca i32, align 4
16 %0 = ptrtoint ptr %a to i64
17 %1 = inttoptr i64 %0 to ptr
18 ret void
19 }
20
21 define i8 @BitCastNarrow() nounwind uwtable safestack {
22 entry:
23 ; CHECK-LABEL: @BitCastNarrow(
24 ; CHECK-NOT: __safestack_unsafe_stack_ptr
25 ; CHECK: ret i8
26 %a = alloca i32, align 4
27 %0 = load i8, ptr %a, align 1
28 ret i8 %0
29 }
30
31 define i64 @BitCastWide() nounwind uwtable safestack {
32 entry:
33 ; CHECK-LABEL: @BitCastWide(
34 ; CHECK: __safestack_unsafe_stack_ptr
35 ; CHECK: ret i64
36 %a = alloca i32, align 4
37 %0 = load i64, ptr %a, align 1
38 ret i64 %0
39 }