1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -O3 -S < %s | FileCheck %s
4 %struct.ss = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
6 define internal void @phantomLoad(ptr %p, ptr %y, ptr %x) {
13 define ptr @parent(ptr align 8 dereferenceable(72) %f, half %val1, i16 %val2, i32 %val3) align 2 {
14 ; CHECK-LABEL: define noundef nonnull ptr @parent
15 ; CHECK-SAME: (ptr readonly returned align 8 dereferenceable(72) [[F:%.*]], half [[VAL1:%.*]], i16 [[VAL2:%.*]], i32 [[VAL3:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] align 2 {
17 ; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i8, ptr [[F]], i64 64
18 ; CHECK-NEXT: [[F_VAL:%.*]] = load ptr, ptr [[TMP0]], align 8
19 ; CHECK-NEXT: [[CMP_NOT_NOT_I:%.*]] = icmp eq i32 [[VAL3]], 0
20 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast half [[VAL1]] to i16
21 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i16 [[VAL2]] to half
22 ; CHECK-NEXT: [[VAL2_SINK_I:%.*]] = select i1 [[CMP_NOT_NOT_I]], i16 [[TMP1]], i16 [[VAL2]]
23 ; CHECK-NEXT: [[VAL1_SINK_I:%.*]] = select i1 [[CMP_NOT_NOT_I]], half [[TMP2]], half [[VAL1]]
24 ; CHECK-NEXT: store i16 [[VAL2_SINK_I]], ptr [[F_VAL]], align 2
25 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[F_VAL]], i64 16
26 ; CHECK-NEXT: store half [[VAL1_SINK_I]], ptr [[TMP3]], align 2
27 ; CHECK-NEXT: ret ptr [[F]]
30 call void @badChild(ptr align 8 dereferenceable(72) %f, half %val1, i16 %val2, i32 %val3) #4
35 define internal void @badChild(ptr align 8 dereferenceable(72) %this, half %val1, i16 %val2, i32 %val3) align 2 {
37 %othergep = getelementptr inbounds %struct.ss, ptr %this, i64 0, i32 2
38 %load0 = load ptr, ptr %othergep, align 8
41 call void @phantomLoad(ptr %load0, ptr %x, ptr %y)
42 %val1.cast = bitcast half %val1 to i16
43 %cmp.not.not = icmp eq i32 %val3, 0
44 br i1 %cmp.not.not, label %if.then, label %if.else
45 if.then: ; preds = %entry
46 %0 = getelementptr inbounds %struct.ss, ptr %this, i64 0, i32 8
47 %1 = load ptr, ptr %0, align 8
48 store i16 %val1.cast, ptr %1, align 2
49 %add.ptr.i.i.i.i = getelementptr inbounds i8, ptr %1, i64 16
50 store i16 %val2, ptr %add.ptr.i.i.i.i, align 2
52 if.else: ; preds = %entry
53 %2 = getelementptr inbounds %struct.ss, ptr %this, i64 0, i32 8
54 %3 = load ptr, ptr %2, align 8
55 %add.ptr.i.i.i.i7 = getelementptr inbounds i8, ptr %3, i64 16
56 store i16 %val1.cast, ptr %add.ptr.i.i.i.i7, align 2
57 store i16 %val2, ptr %3, align 2
59 if.end: ; preds = %if.else, %if.then