From 6aff9af1cb863f698ca8c23ba6dd548500f5f7e2 Mon Sep 17 00:00:00 2001
From: Aaron Sawdey <acsawdey@gcc.gnu.org>
Date: Tue, 2 Jan 2018 10:46:29 -0600
Subject: [PATCH] rtlanal.c (canonicalize_condition): Return 0 if final rtx
 does not have a conditional at the top.

        * rtlanal.c (canonicalize_condition): Return 0 if final rtx
        does not have a conditional at the top.

From-SVN: r256079
---
 gcc/rtlanal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 6d50781a32c3..e75ff103fcbf 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5693,7 +5693,11 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
   if (CC0_P (op0))
     return 0;
 
-  return gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
+  /* We promised to return a comparison.  */
+  rtx ret = gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
+  if (COMPARISON_P (ret))
+    return ret;
+  return 0;
 }
 
 /* Given a jump insn JUMP, return the condition that will cause it to branch
-- 
GitLab