]> git.ipfire.org Git - thirdparty/gcc.git/commit
harden-conditionals: detach values before compares
authorAlexandre Oliva <oliva@adacore.com>
Thu, 27 Apr 2023 05:43:48 +0000 (02:43 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 28 Apr 2023 04:39:40 +0000 (01:39 -0300)
commitf9b9109036110f6a4296b935910db992dc6a34c1
tree702258debc9c74e53d9e5de8e5b8bdf91276e828
parent32a98ccd233101990c15bf898358b4367562a26f
harden-conditionals: detach values before compares

The optimization barriers inserted after compares enable GCC to derive
information about the values from e.g. the taken paths, or the absence
of exceptions.  Move them before the original compares, so that the
reversed compares test copies of the original operands, without
further optimizations.

for  gcc/ChangeLog

* gimple-harden-conditionals.cc (insert_edge_check_and_trap):
Move detach value calls...
(pass_harden_conditional_branches::execute): ... here.
(pass_harden_compares::execute): Detach values before
compares.

for  gcc/testsuite/ChangeLog

* c-c++-common/torture/harden-cond-comp.c: New.
gcc/gimple-harden-conditionals.cc
gcc/testsuite/c-c++-common/torture/harden-cond-comp.c [new file with mode: 0644]