Test Failure: Transforms/JumpThreading/select.ll

Test source: git

Log:

Source: <stdin>
ERROR: Unsupported instruction:   %indirect.goto.dest = select i1 %cond, i8* blockaddress(@test_indirectbr, %L1), i8* %address
ERROR: Unsupported instruction:   %indirect.goto.dest = select i1 %cond, i8* blockaddress(@test_indirectbr_thresh, %L1), i8* %address

----------------------------------------
define void @test_br(i1 %cond, i1 %value) {
%entry:
  br i1 %cond, label %L0, label %L3

%L3:
  call void @baz()
  br label %L0

%L0:
  %expr = select i1 %cond, i1 1, i1 %value
  br i1 %expr, label %L1, label %L2

%L1:
  call void @foo()
  ret void

%L2:
  call void @bar()
  ret void
}
=>
define void @test_br(i1 %cond, i1 %value) {
%entry:
  br i1 %cond, label %L1, label %L0

%L0:
  call void @baz()
  %expr = select i1 %cond, i1 1, i1 %value
  br i1 %expr, label %L1, label %L2

%L2:
  call void @bar()
  ret void

%L1:
  call void @foo()
  ret void
}
Transformation seems to be correct!


----------------------------------------
define void @test_switch(i1 %cond, i8 %value) {
%entry:
  br i1 %cond, label %L0, label %L4

%L4:
  call void @quux()
  br label %L0

%L0:
  %expr = select i1 %cond, i8 1, i8 %value
  switch i8 %expr, label %L3 [
    i8 1, label %L1
    i8 2, label %L2
  ]

%L3:
  call void @baz()
  ret void

%L1:
  call void @foo()
  ret void

%L2:
  call void @bar()
  ret void
}
=>
define void @test_switch(i1 %cond, i8 %value) {
%entry:
  br i1 %cond, label %L1, label %L0

%L0:
  call void @quux()
  %expr = select i1 %cond, i8 1, i8 %value
  switch i8 %expr, label %L3 [
    i8 1, label %L1
    i8 2, label %L2
  ]

%L3:
  call void @baz()
  ret void

%L2:
  call void @bar()
  ret void

%L1:
  call void @foo()
  ret void
}
Transformation seems to be correct!


----------------------------------------
define void @test_switch_cmp(i1 %cond, i32 %val, i8 %value) {
%entry:
  br i1 %cond, label %L0, label %L4

%L4:
  call void @quux()
  br label %L0

%L0:
  %val.phi = phi i32 [ %val, %entry ], [ 4294967295, %L4 ]
  %cmp = icmp slt i32 %val.phi, 0
  %expr = select i1 %cmp, i8 1, i8 %value
  switch i8 %expr, label %L3 [
    i8 1, label %L1
    i8 2, label %L2
  ]

%L3:
  call void @baz()
  ret void

%L1:
  call void @foo()
  ret void

%L2:
  call void @bar()
  ret void
}
=>
define void @test_switch_cmp(i1 %cond, i32 %val, i8 %value) {
%entry:
  br i1 %cond, label %L0, label %L0.thread

%L0.thread:
  call void @quux()
  br label %L1

%L0:
  %val.phi = phi i32 [ %val, %entry ]
  %cmp = icmp slt i32 %val.phi, 0
  br i1 %cmp, label %L1, label %0

%0:
  %1 = phi i8 [ %value, %L0 ]
  switch i8 %1, label %L3 [
    i8 1, label %L1
    i8 2, label %L2
  ]

%L3:
  call void @baz()
  ret void

%L1:
  call void @foo()
  ret void

%L2:
  call void @bar()
  ret void
}
Transformation doesn't verify!
ERROR: Source is more defined than target

Example:
i1 %cond = #x1 (1)
i32 %val = undef
i8 %value = #x01 (1)

Source:
  >> Jump to %L0
i32 %val.phi = any
i1 %cmp = any
i8 %expr = #x01 (1)
  >> Jump to %L1
void = UB triggered!

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

Target:
  >> Jump to %L0
i32 %val.phi = any
i1 %cmp = any
UB triggered on br



------------------- SMT STATS -------------------
Num queries: 20
Num invalid: 0
Num skips:   0
Num trivial: 14 (41.2%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     10 (50.0%)
Num UNSAT:   10 (50.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

+ : 'RUN: at line 1'
+ /home/nuno/alive2/build/opt-alive.sh -S -jump-threading
+ /home/nuno/llvm/build/bin/FileCheck /home/nuno/llvm/llvm/test/Transforms/JumpThreading/select.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nuno/llvm/build/bin/FileCheck /home/nuno/llvm/llvm/test/Transforms/JumpThreading/select.ll

 

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

 

<-- Back