match: Keep conditional in simplification to constant [PR118140].
In PR118140 we simplify _ifc__33 = .COND_IOR (_41, d_lsm.7_11, _46, d_lsm.7_11); to 1: Match-and-simplified .COND_IOR (_41, d_lsm.7_11, _46, d_lsm.7_11) to 1 when _46 == 1. This happens by removing the conditional and applying a | 1 = 1. Normally we re-introduce the conditional and its else value if needed but that does not happen here as we're not dealing with a vector type. For correctness's sake, we must not remove the conditional even for non-vector types. This patch re-introduces a COND_EXPR in such cases. For PR118140 this result in a non-vectorized loop. PR middle-end/118140 gcc/ChangeLog: * gimple-match-exports.cc (maybe_resimplify_conditional_op): Add COND_EXPR when we simplified to a scalar gimple value but still have an else value. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr118140.c: New test. * gcc.target/riscv/rvv/autovec/pr118140.c: New test.
Showing
- gcc/gimple-match-exports.cc 16 additions, 10 deletionsgcc/gimple-match-exports.cc
- gcc/testsuite/gcc.dg/vect/pr118140.c 27 additions, 0 deletionsgcc/testsuite/gcc.dg/vect/pr118140.c
- gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118140.c 29 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/rvv/autovec/pr118140.c
Loading
Please register or sign in to comment