Test Failure: Transforms/LoopUnswitch/basictest.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i32 @test(* %A, i1 %C) {
%entry:
  br label %no_exit

%no_exit:
  %i.0.0 = phi i32 [ 0, %entry ], [ %i.0.0.be, %no_exit.backedge ]
  %gep.upgrd.1 = zext i32 %i.0.0 to i64
  %tmp.7 = gep * %A, 4 x i64 %gep.upgrd.1
  %tmp.13 = load i32, * %tmp.7, align 4
  %tmp.14 = add i32 %tmp.13, 1
  store i32 %tmp.14, * %tmp.7, align 4
  br i1 %C, label %then, label %endif

%then:
  %tmp.29 = load i32, * %tmp.7, align 4
  %tmp.30 = add i32 %tmp.29, 2
  store i32 %tmp.30, * %tmp.7, align 4
  %inc9 = add i32 %i.0.0, 1
  %tmp.112 = icmp ult i32 %inc9, 100000
  br i1 %tmp.112, label %no_exit.backedge, label %return

%endif:
  %inc = add i32 %i.0.0, 1
  %tmp.1 = icmp ult i32 %inc, 100000
  br i1 %tmp.1, label %no_exit.backedge, label %return

%no_exit.backedge:
  %i.0.0.be = phi i32 [ %inc9, %then ], [ %inc, %endif ]
  br label %no_exit

%return:
  ret i32 %tmp.13
}
=>
define i32 @test(* %A, i1 %C) {
%entry:
  br i1 %C, label %entry.split.us, label %entry.entry.split_crit_edge

%entry.entry.split_crit_edge:
  br label %entry.split

%entry.split:
  br label %no_exit

%no_exit:
  %i.0.0 = phi i32 [ 0, %entry.split ], [ %i.0.0.be, %no_exit.backedge ]
  %gep.upgrd.1 = zext i32 %i.0.0 to i64
  %tmp.7 = gep * %A, 4 x i64 %gep.upgrd.1
  %tmp.13 = load i32, * %tmp.7, align 4
  %tmp.14 = add i32 %tmp.13, 1
  store i32 %tmp.14, * %tmp.7, align 4
  br i1 0, label %then, label %endif

%then:
  %tmp.29 = load i32, * %tmp.7, align 4
  %tmp.30 = add i32 %tmp.29, 2
  store i32 %tmp.30, * %tmp.7, align 4
  %inc9 = add i32 %i.0.0, 1
  %tmp.112 = icmp ult i32 %inc9, 100000
  br i1 %tmp.112, label %no_exit.backedge, label %return.us-lcssa

%endif:
  %inc = add i32 %i.0.0, 1
  %tmp.1 = icmp ult i32 %inc, 100000
  br i1 %tmp.1, label %no_exit.backedge, label %return.us-lcssa

%no_exit.backedge:
  %i.0.0.be = phi i32 [ %inc9, %then ], [ %inc, %endif ]
  br label %no_exit

%return.us-lcssa:
  %tmp.13.lcssa.ph = phi i32 [ %tmp.13, %then ], [ %tmp.13, %endif ]
  br label %return

%entry.split.us:
  br label %no_exit.us

%no_exit.us:
  %i.0.0.us = phi i32 [ 0, %entry.split.us ], [ %i.0.0.be.us, %no_exit.backedge.us ]
  %gep.upgrd.1.us = zext i32 %i.0.0.us to i64
  %tmp.7.us = gep * %A, 4 x i64 %gep.upgrd.1.us
  %tmp.13.us = load i32, * %tmp.7.us, align 4
  %tmp.14.us = add i32 %tmp.13.us, 1
  store i32 %tmp.14.us, * %tmp.7.us, align 4
  br i1 1, label %then.us, label %endif.us

%then.us:
  %tmp.29.us = load i32, * %tmp.7.us, align 4
  %tmp.30.us = add i32 %tmp.29.us, 2
  store i32 %tmp.30.us, * %tmp.7.us, align 4
  %inc9.us = add i32 %i.0.0.us, 1
  %tmp.112.us = icmp ult i32 %inc9.us, 100000
  br i1 %tmp.112.us, label %no_exit.backedge.us, label %return.us-lcssa.us

%endif.us:
  %inc.us = add i32 %i.0.0.us, 1
  %tmp.1.us = icmp ult i32 %inc.us, 100000
  br i1 %tmp.1.us, label %no_exit.backedge.us, label %return.us-lcssa.us

%no_exit.backedge.us:
  %i.0.0.be.us = phi i32 [ %inc9.us, %then.us ], [ %inc.us, %endif.us ]
  br label %no_exit.us

%return.us-lcssa.us:
  %tmp.13.lcssa.ph.us = phi i32 [ %tmp.13.us, %then.us ], [ %tmp.13.us, %endif.us ]
  br label %return

%return:
  %tmp.13.lcssa = phi i32 [ %tmp.13.lcssa.ph, %return.us-lcssa ], [ %tmp.13.lcssa.ph.us, %return.us-lcssa.us ]
  ret i32 %tmp.13.lcssa
}
Transformation doesn't verify!
ERROR: The source program doesn't reach a return instruction.
Consider increasing the unroll factor if it has loops


----------------------------------------
define i32 @test2(* %var) {
%0:
  %mem = alloca i64 4, align 4
  store i32 2, * %mem, align 4
  %c = load i32, * %mem, align 4
  br label %loop_begin

%loop_begin:
  %var_val = load i32, * %var, align 4
  switch i32 %c, label %default [
    i32 1, label %inc
    i32 2, label %dec
  ]

%default:
  br label %loop_exit

%loop_exit:
  ret i32 0

%inc:
  call void @incf() noreturn
  br label %loop_begin

%dec:
  call void @decf() noreturn
  br label %loop_begin
}
=>
define i32 @test2(* %var) {
%0:
  %mem = alloca i64 4, align 4
  store i32 2, * %mem, align 4
  %c = load i32, * %mem, align 4
  br label %loop_begin

%loop_begin:
  %var_val = load i32, * %var, align 4
  switch i32 %c, label %default [
    i32 1, label %inc
    i32 2, label %dec
  ]

%default:
  br label %loop_exit

%loop_exit:
  ret i32 0

%inc:
  call void @incf() noreturn
  br label %loop_begin.backedge

%dec:
  call void @decf() noreturn
  br label %loop_begin.backedge

%loop_begin.backedge:
  br label %loop_begin
}
Transformation doesn't verify!
ERROR: The source program doesn't reach a return instruction.
Consider increasing the unroll factor if it has loops


----------------------------------------
define i32 @test3(* %var) {
%0:
  %mem = alloca i64 4, align 4
  store i32 2, * %mem, align 4
  %c = load i32, * %mem, align 4
  br label %loop_begin

%loop_begin:
  %var_val = load i32, * %var, align 4
  call void @conv()
  switch i32 %c, label %default [
    i32 1, label %inc
    i32 2, label %dec
  ]

%default:
  br label %loop_exit

%loop_exit:
  ret i32 0

%inc:
  call void @incf() noreturn
  br label %loop_begin

%dec:
  call void @decf() noreturn
  br label %loop_begin
}
=>
define i32 @test3(* %var) {
%0:
  %mem = alloca i64 4, align 4
  store i32 2, * %mem, align 4
  %c = load i32, * %mem, align 4
  br label %loop_begin

%loop_begin:
  %var_val = load i32, * %var, align 4
  call void @conv()
  switch i32 %c, label %default [
    i32 1, label %inc
    i32 2, label %dec
  ]

%default:
  br label %loop_exit

%loop_exit:
  ret i32 0

%inc:
  call void @incf() noreturn
  br label %loop_begin.backedge

%dec:
  call void @decf() noreturn
  br label %loop_begin.backedge

%loop_begin.backedge:
  br label %loop_begin
}
Transformation doesn't verify!
ERROR: The source program doesn't reach a return instruction.
Consider increasing the unroll factor if it has loops


----------------------------------------
define void @and_i2_as_switch_input(i2 %a) {
%entry:
  br label %for.body

%for.body:
  %i = phi i2 [ 0, %entry ], [ %inc, %for.inc ]
  %and = and i2 %a, %i
  %and1 = and i2 %and, %i
  switch i2 %and1, label %sw.default [
    i2 0, label %sw.bb
    i2 1, label %sw.bb1
  ]

%sw.default:
  br label %sw.epilog

%sw.bb:
  br label %sw.epilog

%sw.bb1:
  br label %sw.epilog

%sw.epilog:
  br label %for.inc

%for.inc:
  %inc = add nsw i2 %i, 1
  %cmp = icmp slt i2 %inc, 3
  br i1 %cmp, label %for.body, label %for.end

%for.end:
  ret void
}
=>
define void @and_i2_as_switch_input(i2 %a) {
%entry:
  %0 = icmp eq i2 %a, 0
  br i1 %0, label %entry.split.us, label %entry.entry.split_crit_edge

%entry.entry.split_crit_edge:
  br label %entry.split

%entry.split:
  br label %for.body

%for.body:
  %i = phi i2 [ 0, %entry.split ], [ %inc, %for.inc ]
  %and = and i2 %a, %i
  %and1 = and i2 %and, %i
  switch i2 %and1, label %sw.default [
    i2 0, label %sw.bb
    i2 1, label %sw.bb1
  ]

%sw.default:
  br label %sw.epilog

%sw.bb:
  br label %sw.epilog

%sw.bb1:
  br label %sw.epilog

%sw.epilog:
  br label %for.inc

%for.inc:
  %inc = add nsw i2 %i, 1
  %cmp = icmp slt i2 %inc, 3
  br i1 %cmp, label %for.body, label %for.end.us-lcssa

%for.end.us-lcssa:
  br label %for.end

%entry.split.us:
  br label %for.body.us

%for.body.us:
  %i.us = phi i2 [ 0, %entry.split.us ], [ %inc.us, %for.inc.us ]
  switch i2 0, label %sw.default.us [
    i2 0, label %sw.bb.us
    i2 1, label %sw.bb1.us
  ]

%sw.default.us:
  br label %sw.epilog.us

%sw.bb.us:
  br label %sw.epilog.us

%sw.bb1.us:
  br label %sw.epilog.us

%sw.epilog.us:
  br label %for.inc.us

%for.inc.us:
  %inc.us = add nsw i2 %i.us, 1
  %cmp.us = icmp slt i2 %inc.us, 3
  br i1 %cmp.us, label %for.body.us, label %for.end.us-lcssa.us

%for.end.us-lcssa.us:
  br label %for.end

%for.end:
  ret void
}
Transformation doesn't verify!
ERROR: Source is more defined than target

Example:
i2 %a = undef

Source:
i2 %i = #x0 (0)
i2 %and = #x0 (0)
i2 %and1 = #x0 (0)
i2 %inc = #x1 (1)
i1 %cmp = #x0 (0)

Target:
i1 %0 = any
i2 %i = #x0 (0)
i2 %and = #x0 (0)
i2 %and1 = #x0 (0)
i2 %inc = #x1 (1)
i1 %cmp = #x0 (0)
i2 %i.us = #x0 (0)
i2 %inc.us = #x1 (1)
i1 %cmp.us = #x0 (0)



------------------- SMT STATS -------------------
Num queries: 3
Num invalid: 0
Num skips:   0
Num trivial: 0 (0.0%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     2 (66.7%)
Num UNSAT:   1 (33.3%)

stderr:

+ : 'RUN: at line 1'
+ /home/nlopes/alive2/build/opt-alive.sh -loop-unswitch -enable-new-pm=0 -verify-loop-info -S
+ /home/nlopes/llvm/build/bin/FileCheck --allow-unused-prefixes=false /home/nlopes/llvm/llvm/test/Transforms/LoopUnswitch/basictest.ll
/home/nlopes/llvm/llvm/test/Transforms/LoopUnswitch/basictest.ll:36:16: error: CHECK-LABEL: expected string not found in input
; CHECK-LABEL: @test2(
               ^
<stdin>:1:1: note: scanning from here

^
<stdin>:1:11: note: possible intended match here

          ^

Input file: <stdin>
Check file: /home/nlopes/llvm/llvm/test/Transforms/LoopUnswitch/basictest.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: 
label:36'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
label:36'1               ?                                                             possible intended match
            2: Alive2: Transform doesn't verify; aborting!
label:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

 

NOTE: This test would pass if undef didn't exist!

 

<-- Back