|
| 1 | +; RUN: opt -function-specialization -force-function-specialization -S < %s | FileCheck %s |
| 2 | + |
| 3 | +; FIXME: Function foo gets specialised even though it contains an instrinsic |
| 4 | +; that is marked as NoDuplicate. |
| 5 | +; Please note that the use of the hardwareloop intrinsic is arbitrary; it's |
| 6 | +; just an easy to use intrinsic that has NoDuplicate. |
| 7 | + |
| 8 | +; CHECK: @foo.1( |
| 9 | +; CHECK: @foo.2( |
| 10 | + |
| 11 | +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
| 12 | + |
| 13 | +@A = external dso_local constant i32, align 4 |
| 14 | +@B = external dso_local constant i32, align 4 |
| 15 | + |
| 16 | +define dso_local i32 @bar(i32 %x, i32 %y) { |
| 17 | +entry: |
| 18 | + %tobool = icmp ne i32 %x, 0 |
| 19 | + br i1 %tobool, label %if.then, label %if.else |
| 20 | + |
| 21 | +if.then: |
| 22 | + %call = call i32 @foo(i32 %x, i32* @A) |
| 23 | + br label %return |
| 24 | + |
| 25 | +if.else: |
| 26 | + %call1 = call i32 @foo(i32 %y, i32* @B) |
| 27 | + br label %return |
| 28 | + |
| 29 | +return: |
| 30 | + %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] |
| 31 | + ret i32 %retval.0 |
| 32 | +} |
| 33 | + |
| 34 | +define internal i32 @foo(i32 %x, i32* %b) { |
| 35 | +entry: |
| 36 | + %0 = load i32, i32* %b, align 4 |
| 37 | + %add = add nsw i32 %x, %0 |
| 38 | + %cmp = call i1 @llvm.test.set.loop.iterations.i32(i32 42) |
| 39 | + ret i32 %add |
| 40 | +} |
| 41 | + |
| 42 | +declare i1 @llvm.test.set.loop.iterations.i32(i32) |
0 commit comments