xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/inline-intrinsic-assert.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -inline -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; PR22857: http://llvm.org/bugs/show_bug.cgi?id=22857
4*9880d681SAndroid Build Coastguard Worker; The inliner should not add an edge to an intrinsic and
5*9880d681SAndroid Build Coastguard Worker; then assert that it did not add an edge to an intrinsic!
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine float @foo(float %f1) {
8*9880d681SAndroid Build Coastguard Worker  %call = call float @bar(float %f1)
9*9880d681SAndroid Build Coastguard Worker  ret float %call
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foo(
12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call fast float @llvm.fabs.f32
13*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine float @bar(float %f1) {
17*9880d681SAndroid Build Coastguard Worker  %call = call float @sqr(float %f1)
18*9880d681SAndroid Build Coastguard Worker  %call1 = call fast float @sqrtf(float %call)
19*9880d681SAndroid Build Coastguard Worker  ret float %call1
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerdefine float @sqr(float %f) {
23*9880d681SAndroid Build Coastguard Worker  %mul = fmul fast float %f, %f
24*9880d681SAndroid Build Coastguard Worker  ret float %mul
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdeclare float @sqrtf(float)
28*9880d681SAndroid Build Coastguard Worker
29