diff options
Diffstat (limited to 'llvm/test/Transforms/LICM/preheader-safe.ll')
-rw-r--r-- | llvm/test/Transforms/LICM/preheader-safe.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LICM/preheader-safe.ll b/llvm/test/Transforms/LICM/preheader-safe.ll index 0bfe123862c..03a7258df11 100644 --- a/llvm/test/Transforms/LICM/preheader-safe.ll +++ b/llvm/test/Transforms/LICM/preheader-safe.ll @@ -112,11 +112,31 @@ loop-if: exit: ret void } + +; Positive test - can hoist something that happens before thrower. +define void @nothrow_header_pos(i64 %x, i64 %y, i1 %cond) { +; CHECK-LABEL: nothrow_header_pos +; CHECK-LABEL: entry +; CHECK: %div = udiv i64 %x, %y +; CHECK-LABEL: loop +; CHECK: call void @use(i64 %div) +entry: + br label %loop +loop: ; preds = %entry, %for.inc + br label %loop-if +loop-if: + %div = udiv i64 %x, %y + call void @use(i64 %div) + br label %loop +} + + ; Negative test - can't move out of throwing block define void @nothrow_header_neg(i64 %x, i64 %y, i1 %cond) { ; CHECK-LABEL: nothrow_header_neg ; CHECK-LABEL: entry ; CHECK-LABEL: loop +; CHECK: call void @maythrow() ; CHECK: %div = udiv i64 %x, %y ; CHECK: call void @use(i64 %div) entry: @@ -124,6 +144,7 @@ entry: loop: ; preds = %entry, %for.inc br label %loop-if loop-if: + call void @maythrow() %div = udiv i64 %x, %y call void @use(i64 %div) br label %loop |