diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-01-08 13:57:26 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-01-08 13:57:26 +0100 |
commit | 7590d975ecfdae4f112b5086c017101c08f07e3e (patch) | |
tree | 646c063194d5f7429b2b0e2ab7afbd7c93f38241 /gcc/tree-vect-loop.cc | |
parent | c131b1d5da412b9b0f0681fc5704cdc9b7cafb04 (diff) | |
download | gcc-7590d975ecfdae4f112b5086c017101c08f07e3e.zip gcc-7590d975ecfdae4f112b5086c017101c08f07e3e.tar.gz gcc-7590d975ecfdae4f112b5086c017101c08f07e3e.tar.bz2 |
lower-bitint: Punt .*_OVERFLOW optimization if cast from IMAGPART_EXPR appears before REALPART_EXPR [PR113119]
_BitInt lowering for .{ADD,SUB,MUL}_OVERFLOW calls which have both
REALPART_EXPR and IMAGPART_EXPR used and have a cast from the IMAGPART_EXPR
to a boolean or normal integral type lowers them at the point of
the REALPART_EXPR statement (which is especially needed if the lhs of
the call is complex with large/huge _BitInt element type); we emit the
stmt to set the lhs of the cast at the same spot as well.
Normally, the lowering of __builtin_{add,sub,mul}_overflow arranges
the REALPART_EXPR to come before IMAGPART_EXPR, followed by cast from that,
but as the testcase shows, a redundant __builtin_*_overflow call and VN
can reorder those and we then ICE because the def-stmt of the former cast
from IMAGPART_EXPR may appear after its uses.
We already check that all of REALPART_EXPR, IMAGPART_EXPR and the cast
from the latter appear in the same bb as the .{ADD,SUB,MUL}_OVERFLOW call
in the optimization, the following patch just extends it to make sure
cast appears after REALPART_EXPR; if not, we punt on the optimization and
expand it as a store of a complex _BitInt on the location of the ifn call.
Only the testcase in the testsuite is changed by the patch, all other
__builtin_*_overflow* calls in the bitint* tests (and there are quite a few)
have REALPART_EXPR first.
2024-01-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/113119
* gimple-lower-bitint.cc (optimizable_arith_overflow): Punt if
both REALPART_EXPR and cast from IMAGPART_EXPR appear, but cast
is before REALPART_EXPR.
* gcc.dg/bitint-61.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions