|
| 1 | +; Check that CilkSanitizer and CSI do not insert hooks for phi nodes |
| 2 | +; at placeholder destinations of task exits. |
| 3 | +; |
| 4 | +; RUN: opt < %s -csan -S | FileCheck %s |
| 5 | +; RUN: opt < %s -passes='cilksan' -S | FileCheck %s |
| 6 | +; RUN: opt < %s -csi -S | FileCheck %s |
| 7 | +; RUN: opt < %s -passes='csi' -S | FileCheck %s |
| 8 | + |
| 9 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 10 | +target triple = "x86_64-unknown-linux-gnu" |
| 11 | + |
| 12 | +; Function Attrs: sanitize_cilk |
| 13 | +define dso_local i32 @compute() #0 { |
| 14 | +entry: |
| 15 | + %syncreg59 = call token @llvm.syncregion.start() |
| 16 | + %syncreg123 = call token @llvm.syncregion.start() |
| 17 | + br label %lor.lhs.false |
| 18 | + |
| 19 | +lor.lhs.false: ; preds = %entry |
| 20 | + br label %lor.lhs.false6 |
| 21 | + |
| 22 | +lor.lhs.false6: ; preds = %lor.lhs.false |
| 23 | + br label %lor.lhs.false8 |
| 24 | + |
| 25 | +lor.lhs.false8: ; preds = %lor.lhs.false6 |
| 26 | + br label %if.end |
| 27 | + |
| 28 | +if.end: ; preds = %lor.lhs.false8 |
| 29 | + br label %pfor.end |
| 30 | + |
| 31 | +pfor.end: ; preds = %if.end |
| 32 | + br label %lor.lhs.false48 |
| 33 | + |
| 34 | +lor.lhs.false48: ; preds = %pfor.end |
| 35 | + br label %lor.lhs.false50 |
| 36 | + |
| 37 | +lor.lhs.false50: ; preds = %lor.lhs.false48 |
| 38 | + br label %lor.lhs.false52 |
| 39 | + |
| 40 | +lor.lhs.false52: ; preds = %lor.lhs.false50 |
| 41 | + br label %lor.lhs.false54 |
| 42 | + |
| 43 | +lor.lhs.false54: ; preds = %lor.lhs.false52 |
| 44 | + br label %if.end58 |
| 45 | + |
| 46 | +if.end58: ; preds = %lor.lhs.false54 |
| 47 | + br i1 undef, label %pfor.ph63, label %pfor.end112 |
| 48 | + |
| 49 | +pfor.ph63: ; preds = %if.end58 |
| 50 | + br label %pfor.cond70 |
| 51 | + |
| 52 | +pfor.cond70: ; preds = %pfor.inc107, %pfor.ph63 |
| 53 | + br label %pfor.detach71 |
| 54 | + |
| 55 | +pfor.detach71: ; preds = %pfor.cond70 |
| 56 | + detach within %syncreg59, label %pfor.body.entry74, label %pfor.inc107 |
| 57 | + |
| 58 | +pfor.body.entry74: ; preds = %pfor.detach71 |
| 59 | + br label %pfor.body76 |
| 60 | + |
| 61 | +pfor.body76: ; preds = %pfor.body.entry74 |
| 62 | + %call77 = call i32 undef() |
| 63 | + br label %pfor.preattach106 |
| 64 | + |
| 65 | +pfor.preattach106: ; preds = %pfor.body76 |
| 66 | + reattach within %syncreg59, label %pfor.inc107 |
| 67 | + |
| 68 | +pfor.inc107: ; preds = %pfor.preattach106, %pfor.detach71 |
| 69 | + br label %pfor.cond70 |
| 70 | + |
| 71 | +pfor.end112: ; preds = %if.end58 |
| 72 | + br label %lor.lhs.false118 |
| 73 | + |
| 74 | +lor.lhs.false118: ; preds = %pfor.end112 |
| 75 | + br label %if.end122 |
| 76 | + |
| 77 | +if.end122: ; preds = %lor.lhs.false118 |
| 78 | + br label %pfor.ph127 |
| 79 | + |
| 80 | +pfor.ph127: ; preds = %if.end122 |
| 81 | + br label %pfor.cond134 |
| 82 | + |
| 83 | +pfor.cond134: ; preds = %pfor.inc173, %pfor.ph127 |
| 84 | + br label %pfor.detach135 |
| 85 | + |
| 86 | +pfor.detach135: ; preds = %pfor.cond134 |
| 87 | + detach within %syncreg123, label %pfor.body.entry138, label %pfor.inc173 |
| 88 | + |
| 89 | +pfor.body.entry138: ; preds = %pfor.detach135 |
| 90 | + br label %pfor.body140 |
| 91 | + |
| 92 | +pfor.body140: ; preds = %pfor.body.entry138 |
| 93 | + %call142 = call i32 undef() |
| 94 | + br label %if.end168 |
| 95 | + |
| 96 | +if.end168: ; preds = %pfor.body140 |
| 97 | + br label %pfor.preattach172 |
| 98 | + |
| 99 | +pfor.preattach172: ; preds = %if.end168 |
| 100 | + reattach within %syncreg123, label %pfor.inc173 |
| 101 | + |
| 102 | +pfor.inc173: ; preds = %pfor.preattach172, %pfor.detach135 |
| 103 | + br label %pfor.cond134 |
| 104 | +} |
| 105 | + |
| 106 | +; CHECK: detach within %syncreg59, label %pfor.body.entry74, label %pfor.inc107 unwind label %{{.+}} |
| 107 | +; CHECK: invoke i32 |
| 108 | +; CHECK-NEXT: to label %{{.+}} unwind label %[[CSI_CLEANUP_TASK:.+]] |
| 109 | + |
| 110 | +; CHECK: detach within %syncreg123, label %pfor.body.entry138, label %pfor.inc173 unwind label %{{.+}} |
| 111 | +; CHECK: invoke i32 |
| 112 | +; CHECK-NEXT: to label %{{.+}} unwind label %[[CSI_CLEANUP_TASK2:.+]] |
| 113 | + |
| 114 | +; CHECK: csi.cleanup.unreachable: |
| 115 | +; CHECK-NOT: phi |
| 116 | +; CHECK: unreachable |
| 117 | + |
| 118 | +; CHECK: [[CSI_CLEANUP_TASK2]]: |
| 119 | +; CHECK: invoke void @llvm.detached.rethrow.sl_p0i8i32s( |
| 120 | +; CHECK-NEXT: to label %csi.cleanup.unreachable unwind label %{{.+}} |
| 121 | + |
| 122 | +; CHECK: [[CSI_CLEANUP_TASK]]: |
| 123 | +; CHECK: invoke void @llvm.detached.rethrow.sl_p0i8i32s( |
| 124 | +; CHECK-NEXT: to label %csi.cleanup.unreachable unwind label %{{.+}} |
| 125 | + |
| 126 | +; Function Attrs: argmemonly nounwind willreturn |
| 127 | +declare token @llvm.syncregion.start() #1 |
| 128 | + |
| 129 | +; Function Attrs: argmemonly willreturn |
| 130 | +declare void @llvm.sync.unwind(token) #2 |
| 131 | + |
| 132 | +; Function Attrs: argmemonly nofree nosync nounwind willreturn |
| 133 | +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #3 |
| 134 | + |
| 135 | +attributes #0 = { sanitize_cilk } |
| 136 | +attributes #1 = { argmemonly nounwind willreturn } |
| 137 | +attributes #2 = { argmemonly willreturn } |
| 138 | +attributes #3 = { argmemonly nofree nosync nounwind willreturn } |
0 commit comments