diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-09-19 16:31:17 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-09-19 16:31:17 +0000 |
| commit | 13e71ce69319d7acdd0e8d57b31c09545d9f2a45 (patch) | |
| tree | c0a6c30fea3bf9e670180b47af4ca12db7b3fd0f /llvm/test/Transforms/Float2Int/basic.ll | |
| parent | 3ecab8e4555aee0b4aa10c413696a67f55948c39 (diff) | |
| download | bcm5719-llvm-13e71ce69319d7acdd0e8d57b31c09545d9f2a45.tar.gz bcm5719-llvm-13e71ce69319d7acdd0e8d57b31c09545d9f2a45.zip | |
[Float2Int] avoid crashing on unreachable code (PR38502)
In the example from:
https://bugs.llvm.org/show_bug.cgi?id=38502
...we hit infinite looping/crashing because we have non-standard IR -
an instruction operand is used before defined.
This and other unusual constructs are allowed in unreachable blocks,
so avoid the problem by using DominatorTree to step around landmines.
Differential Revision: https://reviews.llvm.org/D67766
llvm-svn: 372339
Diffstat (limited to 'llvm/test/Transforms/Float2Int/basic.ll')
| -rw-r--r-- | llvm/test/Transforms/Float2Int/basic.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Float2Int/basic.ll b/llvm/test/Transforms/Float2Int/basic.ll index ad522154eed..615cc601a92 100644 --- a/llvm/test/Transforms/Float2Int/basic.ll +++ b/llvm/test/Transforms/Float2Int/basic.ll @@ -328,3 +328,25 @@ define <4 x i16> @neg_vector(<4 x i8> %a) { %t2 = fptoui <4 x float> %t1 to <4 x i16> ret <4 x i16> %t2 } + +; Don't crash while processing unreachable (non-standard) IR. + +define void @PR38502() { +; CHECK-LABEL: @PR38502( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret void +; CHECK: bogusBB: +; CHECK-NEXT: [[INC1:%.*]] = fadd double [[INC:%.*]], 1.000000e+00 +; CHECK-NEXT: [[INC]] = fadd double [[INC1]], 1.000000e+00 +; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une double [[INC]], 0.000000e+00 +; CHECK-NEXT: br label [[BOGUSBB:%.*]] +; +entry: + ret void + +bogusBB: ; preds = %bogusBB + %inc1 = fadd double %inc, 1.000000e+00 + %inc = fadd double %inc1, 1.000000e+00 + %tobool = fcmp une double %inc, 0.000000e+00 + br label %bogusBB +} |

