1; REQUIRES: asserts 2; RUN: opt -function-specialization -debug -S < %s 2>&1 | FileCheck %s 3 4; The purpose of this test is to check that we don't run the solver as there's 5; nothing to do here. For a test that doesn't trigger function specialisation, 6; it is intentionally 'big' because we also want to check that the ssa.copy 7; intrinsics that are introduced by the solver are cleaned up if we bail 8; early. Thus, first check the debug messages for the introduction of these 9; intrinsics: 10 11; CHECK: FnSpecialization: Analysing decl: foo 12; CHECK: Found replacement{{.*}} call i32 @llvm.ssa.copy.i32 13; CHECK: Found replacement{{.*}} call i32 @llvm.ssa.copy.i32 14 15; Then, make sure the solver didn't run: 16 17; CHECK-NOT: Running solver 18 19; Finally, check the absence and thus removal of these intrinsics: 20 21; CHECK-LABEL: @foo 22; CHECK-NOT: call i32 @llvm.ssa.copy.i32 23 24@N = external dso_local global i32, align 4 25@B = external dso_local global i32*, align 8 26@A = external dso_local global i32*, align 8 27 28define dso_local i32 @foo() { 29entry: 30 br label %for.cond 31 32for.cond: 33 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] 34 %0 = load i32, i32* @N, align 4 35 %cmp = icmp slt i32 %i.0, %0 36 br i1 %cmp, label %for.body, label %for.cond.cleanup 37 38for.cond.cleanup: 39 ret i32 undef 40 41for.body: 42 %1 = load i32*, i32** @B, align 8 43 %idxprom = sext i32 %i.0 to i64 44 %arrayidx = getelementptr inbounds i32, i32* %1, i64 %idxprom 45 %2 = load i32, i32* %arrayidx, align 4 46 %3 = load i32*, i32** @A, align 8 47 %arrayidx2 = getelementptr inbounds i32, i32* %3, i64 %idxprom 48 store i32 %2, i32* %arrayidx2, align 4 49 %inc = add nsw i32 %i.0, 1 50 br label %for.cond 51} 52