[PATCH] D139275: [SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 09:09:12 PST 2022
lebedev.ri added a comment.
-- 49. InstCombinePass
----------------------------------------
define float @_Z1ff(float noundef %0) nofree noundef willreturn memory(none) {
%1:
%2 = fcmp ugt float noundef %0, 0.000000
%3 = fcmp ult float noundef %0, 1.000000
%or.cond = and i1 %2, %3
%4 = fcmp uge float noundef %0, 0.200000
%5 = xor i1 %2, %or.cond
%.0.sel6 = select i1 %5, float 0.100000, float 0.000000
%or.cond7 = and i1 %4, %or.cond
%6 = fadd float noundef %0, -0.100000
%.0 = select i1 %or.cond7, float %6, float %.0.sel6
ret float %.0
}
=>
define float @_Z1ff(float noundef %0) nofree noundef willreturn memory(none) {
%1:
%2 = fcmp ugt float noundef %0, 0.000000
%3 = fcmp ult float noundef %0, 1.000000
%or.cond = and i1 %2, %3
%4 = fcmp uge float noundef %0, 0.200000
%5 = fadd float noundef %0, -0.100000
%.0.sel6 = select i1 %4, float %5, float 0.100000
%.0 = select i1 %or.cond, float %.0.sel6, float 0.000000
ret float %.0
}
Transformation doesn't verify! (unsound)
ERROR: Value mismatch
Example:
float noundef %0 = #x7f800000 (+oo)
Source:
i1 %2 = #x1 (1)
i1 %3 = #x0 (0)
i1 %or.cond = #x0 (0)
i1 %4 = #x1 (1)
i1 %5 = #x1 (1)
float %.0.sel6 = #x3dcccccd (0.100000001490?)
i1 %or.cond7 = #x0 (0)
float %6 = #x7f800000 (+oo)
float %.0 = #x3dcccccd (0.100000001490?)
Target:
i1 %2 = #x1 (1)
i1 %3 = #x0 (0)
i1 %or.cond = #x0 (0)
i1 %4 = #x1 (1)
float %5 = #x7f800000 (+oo)
float %.0.sel6 = #x7f800000 (+oo)
float %.0 = #x00000000 (+0.0)
Source value: #x3dcccccd (0.100000001490?)
Target value: #x00000000 (+0.0)
Pass: InstCombinePass
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' '-tv-exit-on-error' '-O1' '/tmp/test.ll' '-tv-smt-to=20000' '-tv-report-dir=/repositories/alive2/build-Clang-release/logs' '-tv-smt-stats'
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139275/new/
https://reviews.llvm.org/D139275
More information about the llvm-commits
mailing list