brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 7d5e506 Raw
93 lines · plain
1; RUN: opt -S --passes="ipsccp<func-spec>" \2; RUN:        -funcspec-for-literal-constant=false \3; RUN:        -force-specialization < %s | FileCheck %s -check-prefix CHECK-NOLIT4; RUN: opt -S --passes="ipsccp<func-spec>" \5; RUN:        -force-specialization < %s | FileCheck %s -check-prefix CHECK-LIT6 7define i32 @f0(i32 noundef %x) {8entry:9  %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext false)10  ret i32 %call11}12 13define i32 @f1(i32 noundef %x) {14entry:15  %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext true)16  ret i32 %call17}18 19define i32 @g0(i32 noundef %x) {20entry:21  %call = tail call i32 @add(i32 noundef %x, i32 noundef 1)22  ret i32 %call23}24 25define i32 @g1(i32 noundef %x) {26entry:27  %call = tail call i32 @add(i32 noundef %x, i32 noundef 2)28  ret i32 %call29}30 31define float @h0(float noundef %x) {32entry:33  %call = tail call float @addf(float noundef %x, float noundef 1.000000e+00)34  ret float %call35}36 37define float @h1(float noundef %x) {38entry:39  %call = tail call float @addf(float noundef %x, float noundef 2.000000e+00)40  ret float %call41}42 43define internal i32 @neg(i32 noundef %x, i1 noundef zeroext %b) {44entry:45  %sub = sub nsw i32 0, %x46  %cond = select i1 %b, i32 %sub, i32 %x47  ret i32 %cond48}49 50define internal i32 @add(i32 noundef %x, i32 noundef %y) {51entry:52  %add = add nsw i32 %y, %x53  ret i32 %add54}55 56define internal float @addf(float noundef %x, float noundef %y) {57entry:58  %add = fadd float %x, %y59  ret float %add60}61 62 63; Check no functions were specialised.64; CHECK-NOLIT-NOT: @neg.65; CHECK-NOLIT-NOT: @add.66; CHECK-NOLIT-NOT: @addf.67 68; CHECK-LIT-LABEL: define i32 @f069; CHECK-LIT: call i32 @neg.specialized.[[#A:]]70 71; CHECK-LIT-LABEL: define i32 @f172; CHECK-LIT: call i32 @neg.specialized.[[#B:]]73 74; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g075; CHECK-LIT: call i32 @add.specialized.[[#C:]]76 77; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g178; CHECK-LIT: call i32 @add.specialized.[[#D:]]79 80; CHECK-LIT-LABEL: define float @h081; CHECK-LIT: call float @addf.specialized.[[#E:]]82 83; CHECK-LIT-LABEL: define float @h184; CHECK-LIT: call float @addf.specialized.[[#F:]]85 86; Check all of `neg`, `add`, and `addf` were specialised.87; CHECK-LIT-DAG: @neg.specialized.[[#A]]88; CHECK-LIT-DAG: @neg.specialized.[[#B]]89; CHECK-LIT-DAG: @add.specialized.[[#C]]90; CHECK-LIT-DAG: @add.specialized.[[#D]]91; CHECK-LIT-DAG: @addf.specialized.[[#E]]92; CHECK-LIT-DAG: @addf.specialized.[[#F]]93