tree-optimization/112939 - VN PHI visiting and -ftrivial-auto-var-init
commitf5f33b44b5dd4c41ae335445ae3f06b1ca3cfbcb
authorRichard Biener <rguenther@suse.de>
Mon, 11 Dec 2023 12:00:18 +0000 (11 13:00 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 12 Dec 2023 07:14:47 +0000 (12 08:14 +0100)
tree6a56de2ae1ff726e474ba8c8cbe6f3ed7354ff16
parentfc62716fe8d1d60a9f1c6906e5a4845b3331b828
tree-optimization/112939 - VN PHI visiting and -ftrivial-auto-var-init

The following builds upon the last fix, making sure we only value-number
to visited (un-)defs, otherwise prefer .VN_TOP.

PR tree-optimization/112939
* tree-ssa-sccvn.cc (visit_phi): When all args are undefined
make sure we end up with a value that was visited, otherwise
fall back to .VN_TOP.

* gcc.dg/pr112939.c: New testcase.
gcc/testsuite/gcc.dg/pr112939.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc