Test source: git
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<Function> : Skipping NOP -- 2. InstCombinePass ---------------------------------------- define void @fold_ffs(i16 %x) { %0: %n0 = ffs i16 0 call void @sink(i16 %n0) %n1 = ffs i16 1 call void @sink(i16 %n1) %nx = ffs i16 %x call void @sink(i16 %nx) ret void } Transformation seems to be correct! (syntactically equal) -- 3. InstCombinePass ---------------------------------------- define void @fold_ffs(i16 %x) { %0: %n0 = ffs i16 0 call void @sink(i16 %n0) %n1 = ffs i16 1 call void @sink(i16 %n1) %nx = ffs i16 %x call void @sink(i16 %nx) ret void } => define void @fold_ffs(i16 %x) { %0: call void @sink(i16 0) call void @sink(i16 1) %cttz = cttz i16 %x, 1 %range_l#0%cttz = icmp sge i16 %cttz, 0 %range_h#0%cttz = icmp slt i16 %cttz, 17 %range#0%cttz = and i1 %range_l#0%cttz, %range_h#0%cttz assume_non_poison i1 %range#0%cttz %1 = add nsw nuw i16 %cttz, 1 %.not = icmp eq i16 %x, 0 %2 = select i1 %.not, i16 0, i16 %1 call void @sink(i16 %2) ret void } Transformation doesn't verify! (unsound) ERROR: Source is more defined than target Example: i16 %x = undef Source: i16 %n0 = #x0000 (0) Function @sink returned i16 %n1 = #x0001 (1) Function @sink returned i16 %nx = #x0000 (0) [based on undef value] Function @sink returned SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 1 alloc type: 0 Block 1 > size: 0 align: 1 alloc type: 0 Target: Function @sink returned Function @sink returned i16 %cttz = #x0000 (0) i1 %range_l#0%cttz = #x1 (1) i1 %range_h#0%cttz = #x1 (1) i1 %range#0%cttz = #x1 (1) i16 %1 = poison i1 %.not = #x0 (0) i16 %2 = poison Function @sink triggered UB Pass: InstCombinePass Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-load-pass-plugin=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-mtriple=avr-linux' '-passes=instcombine' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats' ------------------- SMT STATS ------------------- Num queries: 4 Num invalid: 0 Num skips: 0 Num trivial: 9 (69.2%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 4 (100.0%) Num UNSAT: 0 (0.0%) Alive2: Transform doesn't verify; aborting!
+ : 'RUN: at line 6' + /home/nlopes/alive2/build/opt-alive.sh -mtriple=avr-linux -passes=instcombine -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/ffs-i16.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/ffs-i16.ll
NOTE: This test would pass if undef didn't exist!