Skip to content
Snippets Groups Projects
Commit 1f619fe2 authored by Andrew Pinski's avatar Andrew Pinski
Browse files

phiopt: Fix VCE moving by rewriting it into cast [PR116098]

Phiopt match_and_simplify might move a well defined VCE assign statement
from being conditional to being uncondtitional; that VCE might no longer
being defined. It will need a rewrite into a cast instead.

This adds the rewriting code to move_stmt for the VCE case.
This is enough to fix the issue at hand. It should also be using rewrite_to_defined_overflow
but first I need to move the check to see a rewrite is needed into its own function
and that is causing issues (see https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663938.html

).
Plus this version is easiest to backport.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/116098

gcc/ChangeLog:

	* tree-ssa-phiopt.cc (move_stmt): Rewrite VCEs from integer to integer
	types to case.

gcc/testsuite/ChangeLog:

	* c-c++-common/torture/pr116098-2.c: New test.
	* g++.dg/torture/pr116098-1.C: New test.

Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
parent 77c3ef08
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment