tree-opt: Fix segfault in tree-if-conv.c with -march=armv8.2-a+sve [PR97849]
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Tue, 24 Nov 2020 01:20:53 +0000 (06:50 +0530)
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Tue, 24 Nov 2020 01:27:46 +0000 (06:57 +0530)
commit5700973f4a30762b4fc21687bb5f7843e55da2e4
treeab46cb4c3c4498841557134ca7ebb937458fc5f4
parent6692c400f207c68fb11b44182ae127856e8b9ad3
tree-opt: Fix segfault in tree-if-conv.c with -march=armv8.2-a+sve [PR97849]

The issue here is that rpo vn may eliminate target ssa_name referred to in
redundant_ssa_names, and thus ifcvt_local_dce may replace candidate
ssa_name with invalid ssa_name resulting in incorrect IR. The patch simply
does ssa_name replacement before calling do_rpo_vn, which fixes the issue.

gcc/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR tree-optimization/97849
* tree-if-conv.c (tree_if_conversion): Move ssa_name
replacement code from ifcvt_local_dce to this function
before calling do_rpo_vn.

gcc/testsuite/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

PR tree-optimization/97849
* gcc.dg/tree-ssa/pr97849.c: New test.
gcc/testsuite/gcc.dg/tree-ssa/pr97849.c [new file with mode: 0644]
gcc/tree-if-conv.c