|
| 1 | +; Check the loop-spawning pass's handling to loop-variant loop conditions. |
| 2 | +; |
| 3 | +; RUN: opt < %s -loop-spawning-ti -S 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR |
| 4 | +; RUN: opt < %s -passes='loop-spawning' -S 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR |
| 5 | +; RUN: opt < %s -licm -loop-spawning-ti -S 2>&1 | FileCheck %s |
| 6 | +; RUN: opt < %s -passes='function(loop(licm)),loop-spawning' -S 2>&1 | FileCheck %s |
| 7 | + |
| 8 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 9 | +target triple = "x86_64-unknown-linux-gnu" |
| 10 | + |
| 11 | +$_ZNK4CPMAI21delta_compressed_leafImEE3sumEv = comdat any |
| 12 | + |
| 13 | +; Function Attrs: argmemonly nounwind willreturn |
| 14 | +declare token @llvm.syncregion.start() #0 |
| 15 | + |
| 16 | +declare dso_local i32 @__gxx_personality_v0(...) |
| 17 | + |
| 18 | +declare dso_local void @_ZNSt6vectorImSaImEEC2EmRKS0_() unnamed_addr #1 align 2 |
| 19 | + |
| 20 | +define dso_local void @_ZNK4CPMAI21delta_compressed_leafImEE3sumEv() local_unnamed_addr #1 comdat align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
| 21 | +entry: |
| 22 | + %syncreg = call token @llvm.syncregion.start() |
| 23 | + invoke void @_ZNSt6vectorImSaImEEC2EmRKS0_() |
| 24 | + to label %invoke.cont unwind label %lpad |
| 25 | + |
| 26 | +invoke.cont: ; preds = %entry |
| 27 | + br label %pfor.cond |
| 28 | + |
| 29 | +lpad: ; preds = %entry |
| 30 | + %0 = landingpad { i8*, i32 } |
| 31 | + cleanup |
| 32 | + unreachable |
| 33 | + |
| 34 | +pfor.cond: ; preds = %pfor.inc, %invoke.cont |
| 35 | + %__begin.0 = phi i64 [ %inc42, %pfor.inc ], [ 0, %invoke.cont ] |
| 36 | + detach within %syncreg, label %pfor.body.entry, label %pfor.inc unwind label %lpad41.loopexit |
| 37 | + |
| 38 | +pfor.body.entry: ; preds = %pfor.cond |
| 39 | + br label %pfor.body |
| 40 | + |
| 41 | +pfor.body: ; preds = %pfor.body.entry |
| 42 | + unreachable |
| 43 | + |
| 44 | +pfor.inc: ; preds = %pfor.cond |
| 45 | + %inc42 = add nuw i64 %__begin.0, 1 |
| 46 | + %umax117 = select i1 undef, i64 undef, i64 1 |
| 47 | + %exitcond118.not = icmp eq i64 %inc42, %umax117 |
| 48 | + br i1 %exitcond118.not, label %pfor.cond.cleanup, label %pfor.cond, !llvm.loop !1 |
| 49 | + |
| 50 | +pfor.cond.cleanup: ; preds = %pfor.inc |
| 51 | + unreachable |
| 52 | + |
| 53 | +lpad41.loopexit: ; preds = %pfor.cond |
| 54 | + %lpad.loopexit = landingpad { i8*, i32 } |
| 55 | + cleanup |
| 56 | + resume { i8*, i32 } %lpad.loopexit |
| 57 | +} |
| 58 | + |
| 59 | +; CHECK-ERROR: Tapir loop not transformed: failed to use divide-and-conquer loop spawning. |
| 60 | + |
| 61 | +; CHECK: define dso_local void @_ZNK4CPMAI21delta_compressed_leafImEE3sumEv() |
| 62 | +; CHECK: invoke.cont: |
| 63 | +; CHECK: invoke {{.*}}void @_ZNK4CPMAI21delta_compressed_leafImEE3sumEv.outline_pfor.cond.ls1( |
| 64 | + |
| 65 | +; CHECK: define {{.*}}void @_ZNK4CPMAI21delta_compressed_leafImEE3sumEv.outline_pfor.cond.ls1( |
| 66 | +; CHECK: pfor.inc.ls1: |
| 67 | +; CHECK: %[[INC:.+]] = add nuw i64 |
| 68 | +; CHECK: %[[CMP:.+]] = icmp eq i64 %[[INC]] |
| 69 | +; CHECK: br i1 %[[CMP]], label %pfor.cond.cleanup.ls1, label %pfor.cond.ls1 |
| 70 | + |
| 71 | +attributes #0 = { argmemonly nounwind willreturn } |
| 72 | +attributes #1 = { "use-soft-float"="false" } |
| 73 | + |
| 74 | +!llvm.ident = !{!0} |
| 75 | + |
| 76 | +!0 = !{! "clang version 12.0.0 ([email protected]:OpenCilk/opencilk-project.git 6483c891d59b7ee269d7dbde7cbf3dd36b83dd69)"} |
| 77 | +!1 = distinct !{!1, !2, !3} |
| 78 | +!2 = !{!"tapir.loop.spawn.strategy", i32 1} |
| 79 | +!3 = !{!"llvm.loop.unroll.disable"} |
0 commit comments