llvm.org GIT mirror llvm / a54df3d
[SimpleLoopUnswitch] Add a test case exposing a bug This test exposes a bug in SimpleLoopUnswitch that leads to a crash on assert(SuccessorsCount > 1 && "Cannot unswitch a condition without multiple distinct successors!"); when SimpleLoopUnswitch considers unswitching of a loop by a switch with one successor. Fix will be submitted soon. Patch Author: Daniil Suchkov. Reviewers: reames, asbirlea, skatkov Reviewed By: skatkov Subscribers: zzheng, llvm-commits Differential Revision: https://reviews.llvm.org/D64403 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365600 91177308-0d34-0410-b5e6-96231b3b80d8 Serguei Katkov 2 months ago
1 changed file(s) with 25 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; REQUIRES: asserts
1 ; XFAIL: *
2 ; RUN: opt -passes='unswitch' -disable-output -S < %s
3 ; RUN: opt -simple-loop-unswitch -enable-nontrivial-unswitch -disable-output -S < %s
4
5 ; This loop shouldn't trigger asserts in SimpleLoopUnswitch.
6 define void @test_redundant_switch(i1* %ptr, i32 %cond) {
7 entry:
8 br label %loop_begin
9
10 loop_begin:
11 switch i32 %cond, label %loop_body [
12 i32 0, label %loop_body
13 ]
14
15 loop_body:
16 br label %loop_latch
17
18 loop_latch:
19 %v = load i1, i1* %ptr
20 br i1 %v, label %loop_begin, label %loop_exit
21
22 loop_exit:
23 ret void
24 }