brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 2f42125 Raw
83 lines · plain
1; RUN: opt -S --passes="ipsccp<func-spec>" -funcspec-for-literal-constant=false < %s | FileCheck %s2define dso_local i32 @p0(i32 noundef %x) {3entry:4  %add = add nsw i32 %x, 15  ret i32 %add6}7 8define dso_local i32 @p1(i32 noundef %x) {9entry:10  %sub = add nsw i32 %x, -111  ret i32 %sub12}13 14; CHECK-LABEL: define dso_local i32 @f015; CHECK:       tail call fastcc i32 @g.specialized.[[#A:]]({{.*}}@p0)16;17define dso_local i32 @f0(i32 noundef %x) {18entry:19  %call = tail call fastcc i32 @g(i32 noundef %x, ptr noundef nonnull @p0)20  ret i32 %call21}22 23; CHECK-LABEL: define dso_local i32 @f124; CHECK:       tail call fastcc i32 @g.specialized.[[#B:]]({{.*}}@p1)25;26define dso_local i32 @f1(i32 noundef %x) {27entry:28  %call = tail call fastcc i32 @g(i32 noundef %x, ptr noundef nonnull @p1)29  ret i32 %call30}31 32; @g gets fully specialized33; CHECK-NOT: define internal fastcc i32 @g(34 35define internal fastcc i32 @g(i32 noundef %x, ptr nocapture noundef readonly %p) noinline  {36entry:37  %pcall = tail call i32 %p(i32 noundef %x)38  %fcall = tail call fastcc i32 @f(i32 noundef %pcall, ptr noundef nonnull %p)39  ret i32 %fcall40}41 42; CHECK-LABEL: define dso_local i32 @g043; CHECK:       tail call fastcc i32 @f.specialized.[[#C:]]({{.*}}@p0)44;45define dso_local i32 @g0(i32 noundef %x) {46entry:47  %call = tail call fastcc i32 @f(i32 noundef %x, ptr noundef nonnull @p0)48  ret i32 %call49}50 51define internal fastcc i32 @f(i32 noundef %x, ptr nocapture noundef readonly %p) noinline  {52entry:53  %call = tail call i32 %p(i32 noundef %x)54  %add = add nsw i32 %call, %x55  ret i32 %add56}57 58; CHECK-LABEL: define dso_local i32 @g159; CHECK:       tail call fastcc i32 @f.specialized.[[#D:]]({{.*}}@p1)60;61define dso_local i32 @g1(i32 noundef %x) {62entry:63  %call = tail call fastcc i32 @f(i32 noundef %x, ptr noundef nonnull @p1)64  ret i32 %call65}66 67define dso_local i32 @g2(i32 noundef %x) {68entry:69  %call = tail call fastcc i32 @f(i32 noundef %x, ptr poison)70  ret i32 %call71}72 73; Check that a single argument, that cannot be used for specialisation, does not74; prevent specialisation based on other arguments.75;76; Also check that for callsites which reside in the body of newly created77; (specialized) functions, the lattice value of the arguments is known.78;79; CHECK-DAG: define internal fastcc i32 @g.specialized.[[#A]]80; CHECK-DAG: define internal fastcc i32 @g.specialized.[[#B]]81; CHECK-DAG: define internal fastcc i32 @f.specialized.[[#C]]82; CHECK-DAG: define internal fastcc i32 @f.specialized.[[#D]]83