1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=ipsccp -S < %s | FileCheck %s
5 ; thread_local int gtl = 0;
8 ; static int callee(int *thread_local_ptr, int *shared_ptr) {
9 ; return *thread_local_ptr + *shared_ptr;
12 ; void broker(int *, int (*callee)(int *, int *), int *);
15 ; broker(>l, callee, &gsh);
18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20 @gtl = dso_local thread_local global i32 0, align 4
21 @gsh = dso_local global i32 0, align 4
23 define internal i32 @callee(ptr %thread_local_ptr, ptr %shared_ptr) {
24 ; CHECK-LABEL: @callee(
26 ; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[THREAD_LOCAL_PTR:%.*]], align 4
27 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[SHARED_PTR:%.*]], align 4
28 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP]], [[TMP1]]
29 ; CHECK-NEXT: ret i32 [[ADD]]
32 %tmp = load i32, ptr %thread_local_ptr, align 4
33 %tmp1 = load i32, ptr %shared_ptr, align 4
34 %add = add nsw i32 %tmp, %tmp1
38 define dso_local void @caller() {
39 ; CHECK-LABEL: @caller(
41 ; CHECK-NEXT: call void @broker(ptr nonnull @gtl, ptr nonnull @callee, ptr nonnull @gsh)
42 ; CHECK-NEXT: ret void
45 call void @broker(ptr nonnull @gtl, ptr nonnull @callee, ptr nonnull @gsh)
49 declare !callback !0 dso_local void @broker(ptr, ptr, ptr)
51 !1 = !{i64 1, i64 0, i64 2, i1 false}