Test Failure: Transforms/StructurizeCFG/invert-constantexpr.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
@g = global 4 bytes, align 4

define void @invert_constantexpr_condition(i32 %arg, i32 %arg1) {
bb:
  %tmp = icmp eq i32 %arg, 0
  %__constexpr_0 = ptrtoint ptr @g to i1
  br i1 %__constexpr_0, label %bb2, label %bb6

bb2:
  br i1 %tmp, label %bb3, label %bb6

bb6:
  %tmp7 = icmp slt i32 %arg, %arg1
  br label %bb3

bb3:
  %tmp4 = phi i1 [ %tmp7, %bb6 ], [ undef, %bb2 ]
  %__constexpr_1 = ptrtoint ptr @g to i1
  %tmp5 = or i1 %tmp4, %__constexpr_1
  br i1 %tmp5, label %bb8, label %bb8

bb8:
  ret void
}
=>
@g = global 4 bytes, align 4

define void @invert_constantexpr_condition(i32 %arg, i32 %arg1) {
bb:
  %tmp = icmp ne i32 %arg, 0
  %__constexpr_0 = ptrtoint ptr @g to i1
  br i1 %__constexpr_0, label %bb2, label %Flow

bb2:
  br label %Flow

Flow:
  %__constexpr_3 = ptrtoint ptr @g to i1
  %__constexpr_2 = xor i1 %__constexpr_3, 1
  %#0 = phi i1 [ %tmp, %bb2 ], [ %__constexpr_2, %bb ]
  br i1 %#0, label %bb6, label %bb3

bb6:
  br label %bb3

bb3:
  br label %bb8

bb8:
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i32 %arg = undef
i32 %arg1 = #x80000000 (2147483648, -2147483648)

Source:
i1 %tmp = #x0 (0)	[based on undef]
i1 %__constexpr_0 = #x0 (0)
  >> Jump to %bb6
i1 %tmp7 = #x0 (0)
  >> Jump to %bb3
i1 %tmp4 = #x0 (0)
i1 %__constexpr_1 = #x0 (0)
i1 %tmp5 = #x0 (0)
  >> Jump to %bb8

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 4	align: 4	alloc type: 0	alive: true	address: 1024

Target:
i1 %tmp = #x1 (1)	[based on undef]
i1 %__constexpr_0 = #x0 (0)
  >> Jump to %Flow
i1 %__constexpr_3 = #x0 (0)
i1 %__constexpr_2 = #x1 (1)
i1 %#0 = #x1 (1)
UB triggered on br


Pass: 
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-tv' '-S' '-o' '-' '-structurizecfg' '-tv' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'


------------------- SMT STATS -------------------
Num queries: 15
Num invalid: 0
Num skips:   0
Num trivial: 13 (46.4%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     10 (66.7%)
Num UNSAT:   5 (33.3%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -o - -structurizecfg < /bitbucket/nlopes/llvm/llvm/test/Transforms/StructurizeCFG/invert-constantexpr.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StructurizeCFG/invert-constantexpr.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -o - -structurizecfg
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StructurizeCFG/invert-constantexpr.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StructurizeCFG/invert-constantexpr.ll

 

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

 

<-- Back