From: Michael Collison <collison@rivosinc.com>
To: gcc@gcc.gnu.org
Subject: Need help with match.pd crash
Date: Thu, 6 Oct 2022 18:57:40 -0400 [thread overview]
Message-ID: <d7fe3666-129b-150e-d55b-9649e967ea8c@rivosinc.com> (raw)
I am trying to improve code generation for coremark to match a recent
improvement that was made in LLVM.
I added the following transformation to match.pd which attempts to
replace a branch with straight line code:
/* (cond (and (x , 0x1) == 0), y, (z ^ y) ) -> (-(and (x , 0x1)) & z ) ^
y */
(simplify
(cond (eq (bit_and @0 integer_onep@1)
integer_zerop)
@2
(bit_xor:c @3 @2))
(bit_xor (bit_and (negate (bit_and @0 @1)) @3) @2))
I get a internal error, but in stepping through the debugger I can see
the pattern matches, but fails when when it tries to further simplify
and match another pattern in match.pd:
/* x & C -> x if we know that x & ~C == 0. */
#if GIMPLE
(simplify
(bit_and SSA_NAME@0 INTEGER_CST@1)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& wi::bit_and_not (get_nonzero_bits (@0), wi::to_wide (@1)) == 0)
@0))
#endif
The crash occurs in wi::bit_and_not. Before digging further I want to
ask if there is a problem with the way I wrote the transformation?
next reply other threads:[~2022-10-06 22:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 22:57 Michael Collison [this message]
2022-10-06 23:18 ` Andrew Pinski
2022-10-06 23:22 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d7fe3666-129b-150e-d55b-9649e967ea8c@rivosinc.com \
--to=collison@rivosinc.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).