]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/98640 - fix bogus sign-extension with VN
authorRichard Biener <rguenther@suse.de>
Wed, 13 Jan 2021 08:43:52 +0000 (09:43 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 3 Mar 2021 09:49:38 +0000 (10:49 +0100)
commit268b54382e5248ee1a5e3f4a0841358e03290d17
treec0edf51336f0e7852f0907937a1147274ec87fc0
parent4f0d8562af81709db39d7899993dd2bf98af28ec
tree-optimization/98640 - fix bogus sign-extension with VN

VN tried to express a sign extension from int to long of
a trucated quantity with a plain conversion but that loses the
truncation.  Since there's no single operand doing truncate plus
sign extend (there was a proposed SEXT_EXPR to do that at some
point mapping to RTL sign_extract) don't bother to appropriately
model this with two ops (which the VN insert machinery doesn't
handle and which is unlikely to CSE fully).

2021-01-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/98640
* tree-ssa-sccvn.c (visit_nary_op): Do not try to
handle plus or minus from a truncated operand to be
sign-extended.

* gcc.dg/torture/pr98640.c: New testcase.

(cherry picked from commit ffd28c265e6d611983cd27e9332dc799039a3f04)
gcc/testsuite/gcc.dg/torture/pr98640.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c