Skip to content

Commit 2c4d914

Browse files
committed
[Test] Add failing test that demonstrates buggy behavior of ADCE
ADCE messes up with loop info (proved for new pass manager only) by making some loop blocks unreachable, without making proper updates to the loop.
1 parent e833e58 commit 2c4d914

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; RUN: opt -passes='loop(licm),adce,loop(licm)' -S < %s | FileCheck %s
2+
;
3+
; XFAIL: *
4+
; REQUIRES: asserts
5+
;
6+
; This test demonstrates a bug in ADCE's work with loop info. It does some
7+
; changes that make loop's block unreachable, but never bothers to update
8+
; loop info accordingly.
9+
10+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
11+
target triple = "x86_64-unknown-linux-gnu"
12+
13+
define void @test() {
14+
; CHECK-LABEL: test
15+
16+
bb:
17+
br label %bb2
18+
19+
bb1: ; preds = %bb4
20+
ret void
21+
22+
bb2: ; preds = %bb4, %bb
23+
br i1 undef, label %bb4, label %bb3
24+
25+
bb3: ; preds = %bb2
26+
br label %bb4
27+
28+
bb4: ; preds = %bb3, %bb2
29+
br i1 undef, label %bb1, label %bb2
30+
}

0 commit comments

Comments
 (0)