[gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Support only loops with SSA_NAMEs and CONSTANTS.

Martin Liska marxin@gcc.gnu.org
Thu Dec 9 12:48:52 GMT 2021


https://gcc.gnu.org/g:9113eebec0a7af8bbcb5ad091197856bff267301

commit 9113eebec0a7af8bbcb5ad091197856bff267301
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Dec 8 11:15:56 2021 +0100

    Support only loops with SSA_NAMEs and CONSTANTS.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 6e25eb703fe..cb4be6d52e2 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -370,6 +370,10 @@ find_unswitching_predicates_for_bb (basic_block bb, class loop *loop,
       tree lhs = gimple_cond_lhs (stmt);
       tree rhs = gimple_cond_rhs (stmt);
 
+      if (TREE_CODE (lhs) != SSA_NAME
+	  || !TREE_CONSTANT (rhs))
+	return;
+
       cond = build2 (gimple_cond_code (stmt), boolean_type_node, lhs, rhs);
       edge edge_true, edge_false;
       extract_true_false_edges_from_block (bb, &edge_true, &edge_false);


More information about the Gcc-cvs mailing list