[NFC][InstCombine] Add miscompile reproducer from https://reviews.llvm.org/D139275#4001580
SimplifyCFG change is correct and not at fault here. The actual miscompile appears to be happening in InstCombine. ``` $ /builddirs/llvm-project/build-Clang15/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -passes='tv,instcombine,tv' -o /dev/null /repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll ---------------------------------------- define float @D139275_c4001580(float %arg) { %0: %i = fcmp ugt float %arg, 0.000000 %i1 = fcmp ult float %arg, 1.000000 %i2 = and i1 %i, %i1 %i3 = fcmp uge float %arg, 0.100000 %i4 = xor i1 %i, %i2 %i5 = select i1 %i4, float 0.100000, float 0.000000 %i6 = and i1 %i3, %i2 %i7 = fadd float %arg, -0.100000 %i8 = select i1 %i6, float %i7, float %i5 ret float %i8 } => define float @D139275_c4001580(float %arg) { %0: %i = fcmp ugt float %arg, 0.000000 %i1 = fcmp ult float %arg, 1.000000 %i2 = and i1 %i, %i1 %i3 = fcmp uge float %arg, 0.100000 %i7 = fadd float %arg, -0.100000 %i5 = select i1 %i3, float %i7, float 0.100000 %i8 = select i1 %i2, float %i5, float 0.000000 ret float %i8 } Transformation doesn't verify! (unsound) ERROR: Value mismatch Example: float %arg = #x3dcbb820 (0.099472284317?) Source: i1 %i = #x1 (1) i1 %i1 = #x1 (1) i1 %i2 = #x1 (1) i1 %i3 = #x0 (0) i1 %i4 = #x0 (0) float %i5 = #x00000000 (+0.0) i1 %i6 = #x0 (0) float %i7 = #xba0a5680 (-0.000527717173?) float %i8 = #x00000000 (+0.0) Target: i1 %i = #x1 (1) i1 %i1 = #x1 (1) i1 %i2 = #x1 (1) i1 %i3 = #x0 (0) float %i7 = #xba0a5680 (-0.000527717173?) float %i5 = #x3dcccccd (0.100000001490?) float %i8 = #x3dcccccd (0.100000001490?) Source value: #x00000000 (+0.0) Target value: #x3dcccccd (0.100000001490?) Pass: (anonymous namespace)::TVPass Command line: '/builddirs/llvm-project/build-Clang15/bin/opt' '-load' '/repositories/alive2/build-Clang-release/tv/tv.so' '-load-pass-plugin' '/repositories/alive2/build-Clang-release/tv/tv.so' '-passes=tv,instcombine,tv' '-o' '/dev/null' '/repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll' Alive2: Transform doesn't verify! ```
Loading
Please sign in to comment