Test source: git
Source: <stdin> ---------------------------------------- define i16 @foo(i16 %x) { %0: %t1 = and i16 %x, 255 %t2 = zext i16 %t1 to i32 %t3 = icmp ult i32 %t2, 255 %t4 = select i1 %t3, i32 %t2, i32 255 %t5 = trunc i32 %t4 to i16 %t6 = and i16 %t5, 255 ret i16 %t6 } => define i16 @foo(i16 %x) { %0: %t1 = and i16 %x, 255 ret i16 %t1 } Transformation seems to be correct! ---------------------------------------- define i16 @min_max_clamp(i16 %x) { %0: %a = icmp sgt i16 %x, 63488 %b = select i1 %a, i16 %x, i16 63488 %c = icmp slt i16 %b, 2047 %d = select i1 %c, i16 %b, i16 2047 %e = add i16 %d, 1 ret i16 %e } => define i16 @min_max_clamp(i16 %x) { %0: %a = icmp sgt i16 %x, 63488 %b = select i1 %a, i16 %x, i16 63488 %c = icmp slt i16 %b, 2047 %d = select i1 %c, i16 %b, i16 2047 %e = add nsw i16 %d, 1 ret i16 %e } Transformation doesn't verify! ERROR: Target is more poisonous than source Example: i16 %x = undef Source: i1 %a = undef i16 %b = undef i1 %c = undef i16 %d = undef i16 %e = undef Target: i1 %a = #x1 (1) i16 %b = #x07fe (2046) i1 %c = #x1 (1) i16 %d = #x7fff (32767) i16 %e = poison Source value: undef Target value: poison ------------------- SMT STATS ------------------- Num queries: 10 Num invalid: 0 Num skips: 0 Num trivial: 6 (37.5%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 3 (30.0%) Num UNSAT: 7 (70.0%)
+ : 'RUN: at line 2' + /home/nlopes/alive2/scripts/opt-alive.sh -S -instcombine + /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/max_known_bits.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/InstCombine/max_known_bits.ll
NOTE: This test would pass if undef didn't exist!