On 05/06/2017 05:56 PM, Andrew Pinski wrote:
On Sat, May 6, 2017 at 4:55 PM, Andrew Pinski <pins...@gmail.com> wrote:
On Sat, May 6, 2017 at 8:03 AM, Jeff Law <l...@redhat.com> wrote:
This is the 2nd of 3-5 patches to address pr78496.
Jump threading will examine ASSERT_EXPRs as it walks the IL and record
information from those ASSERT_EXPRs into the available expression and
const/copies tables where they're later used to simplify conditionals.
We're missing a couple things though.
First an ASSERT_EXPR with an EQ test creates an equality we can enter into
the const/copy tables. We were failing to do that. This is most
interesting when the RHS of the condition in the ASSERT_EXPR is a constant,
obviously. This has a secondary benefit of doing less work to get better
optimization.
Second, some ASSERT_EXPRs may start off as a relational test such as x <= 0,
but after range extraction and propagation they could be simplified into an
equality comparison. We already do this with conditionals and generalizing
that code to handle ASSERT_EXPRs is pretty easy. This gives us more chances
to extract simple equivalences from the condition in ASSERT_EXPRs.
This patch fixes those 2 problems. I don't think it directly helps pr78496
right now as we're unable to pick up the newly exposed jump threads until
VRP2. But that's a short term limitation that I've already addressed
locally :-)
Bootstrapped, regression tested and installed on the trunk.
After this patch on aarch64-linux-gnu I get a bootstrap failure while
linking lto1/cc1/cc1plus/go1 in stage2:
godump.o: In function `go_define(unsigned int, char const*)':
godump.c:(.text+0x36c): relocation truncated to fit:
R_AARCH64_ADR_PREL_LO21 against `.rodata'
godump.c:(.text+0x4b4): relocation truncated to fit:
R_AARCH64_ADR_PREL_LO21 against `.rodata'
collect2: error: ld returned 1 exit status
../../gcc/gcc/lto/Make-lang.in:81: recipe for target 'lto1' failed
make[3]: *** [lto1] Error 1
I should mention this is even after the patch to
simplify_assert_expr_using_ranges .
Just spun up an aarch64 machine for testing and it's failing for me too.
I'll revert the patch and dig in.
jeff