Test Failure: Transforms/IndVarSimplify/loop-predication.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i32 @test1(* %array, i32 %length, i32 %n) {
%loop.preheader:
  br label %loop

%loop:
  %loop.acc = phi i32 [ 0, %loop.preheader ], [ %loop.acc.next, %guarded ]
  %i = phi i32 [ 0, %loop.preheader ], [ %i.next, %guarded ]
  %within.bounds = icmp ult i32 %i, %length
  br i1 %within.bounds, label %guarded, label %deopt

%guarded:
  %i.i64 = zext i32 %i to i64
  %array.i.ptr = gep inbounds * %array, 4 x i64 %i.i64
  %array.i = load i32, * %array.i.ptr, align 4
  %loop.acc.next = add i32 %loop.acc, %array.i
  %i.next = add nuw i32 %i, 1
  %continue = icmp ult i32 %i.next, %n
  br i1 %continue, label %loop, label %exit

%exit:
  %result = phi i32 [ %loop.acc.next, %guarded ]
  ret i32 %result

%deopt:
  call void @prevent_merging()
  ret i32 4294967295
}
=>
define i32 @test1(* %array, i32 %length, i32 %n) {
%loop.preheader:
  %0 = icmp ugt i32 %n, 1
  %umax = select i1 %0, i32 %n, i32 1
  %1 = add i32 %umax, 4294967295
  %2 = icmp ult i32 %length, %1
  %umin = select i1 %2, i32 %length, i32 %1
  %3 = icmp ne i32 %length, %umin
  br label %loop

%loop:
  %loop.acc = phi i32 [ 0, %loop.preheader ], [ %loop.acc.next, %guarded ]
  %i = phi i32 [ 0, %loop.preheader ], [ %i.next, %guarded ]
  br i1 %3, label %guarded, label %deopt

%guarded:
  %i.i64 = zext i32 %i to i64
  %array.i.ptr = gep inbounds * %array, 4 x i64 %i.i64
  %array.i = load i32, * %array.i.ptr, align 4
  %loop.acc.next = add i32 %loop.acc, %array.i
  %i.next = add nuw i32 %i, 1
  %continue = icmp ult i32 %i.next, %n
  br i1 %continue, label %loop, label %exit

%exit:
  %result = phi i32 [ %loop.acc.next, %guarded ]
  ret i32 %result

%deopt:
  call void @prevent_merging()
  ret i32 4294967295
}
Transformation doesn't verify!
ERROR: Source is more defined than target

Example:
* %array = undef
i32 %length = #x00000000 (0)
i32 %n = undef

Source:
i32 %loop.acc = #x00000000 (0)
i32 %i = #x00000000 (0)
i1 %within.bounds = #x0 (0)
i64 %i.i64 = #x0000000000000000 (0)
* %array.i.ptr = poison
i32 %array.i = poison
i32 %loop.acc.next = poison
i32 %i.next = #x00000001 (1)
i1 %continue = undef
i32 %result = poison

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 64	alloc type: 0
Block 1 >	align: 2	alloc type: 0
Block 2 >	align: 4	alloc type: 0

Target:
i1 %0 = #x1 (1)
i32 %umax = #x00000001 (1)
i32 %1 = #x00000000 (0)
i1 %2 = #x0 (0)
i32 %umin = #x00000100 (256)
i1 %3 = #x1 (1)
i32 %loop.acc = #x00000000 (0)
i32 %i = #x00000000 (0)
i64 %i.i64 = #x0000000000000000 (0)
* %array.i.ptr = poison
i32 %array.i = poison
i32 %loop.acc.next = poison
i32 %i.next = #x00000001 (1)
i1 %continue = #x0 (0)
i32 %result = poison



------------------- 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 2'
+ /home/nlopes/alive2/scripts/opt-alive.sh -indvars -indvars-predicate-loops=1 -S
+ /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/IndVarSimplify/loop-predication.ll

Alive2: Transform doesn't verify; aborting!
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/IndVarSimplify/loop-predication.ll

 

<-- Back