summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-18 17:17:14 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-18 17:17:14 +0000
commit40c562ee23d8f14dbb39ea5beb6a39ff8e99c370 (patch)
tree1f9cb33de6c2b56bbe4cfc7761ac15dc58e0038a /gcc/cse.c
parentf69e6a990b5fa6d2f01c82fd210b8cd538def834 (diff)
downloadgcc-40c562ee23d8f14dbb39ea5beb6a39ff8e99c370.tar.gz
[PATCH] [PR rtl-optimization/49847] Fix ICE in CSE due to cc0-setter and cc0-user in different blocks
PR rtl-optimization/49847 * cse.c (record_jump_equiv): Handle fold_rtx returning NULL_RTX. PR rtl-optimization/49847 * g++.dg/pr49847-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index cb78a95c0b8..4232028f54f 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3874,6 +3874,13 @@ record_jump_equiv (rtx_insn *insn, bool taken)
op0 = fold_rtx (XEXP (XEXP (SET_SRC (set), 0), 0), insn);
op1 = fold_rtx (XEXP (XEXP (SET_SRC (set), 0), 1), insn);
+ /* On a cc0 target the cc0-setter and cc0-user may end up in different
+ blocks. When that happens the tracking of the cc0-setter via
+ PREV_INSN_CC0 is spoiled. That means that fold_rtx may return
+ NULL_RTX. In those cases, there's nothing to record. */
+ if (op0 == NULL_RTX || op1 == NULL_RTX)
+ return;
+
code = find_comparison_args (code, &op0, &op1, &mode0, &mode1);
if (! cond_known_true)
{