[Bug tree-optimization/108819] [12/13 Regression] ICE on valid code at -O1 with "-fno-tree-ccp -fno-tree-forwprop" on x86_64-linux-gnu: tree check: expected ssa_name, have integer_cst in number_of_iterations_cltz, at tree-ssa-loop-niter.cc:2394
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 17 13:20:23 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108819
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I have a patch to make niter analysis more defensive, the 1 & 1 is introduced
by reassoc:
@@ -30,8 +54,8 @@
<bb 4> [local count: 114863530]:
_20 = a.0_1 == 0;
_21 = a.0_1 > 0;
- _22 = _20 & _21;
- if (_22 != 0)
+ _7 = 1 & 1;
+ if (_7 != 0)
where update_range_test gets a '1' as result and forces that to an SSA name
and things go downhill from that. With
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index f163612f140..c2b30a03a9d 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -2950,6 +2950,9 @@ update_range_test (struct range_entry *range, struct
range_entry *otherrange,
}
if (stmt == NULL)
gcc_checking_assert (tem == op);
+ /* When range->exp is a constant, we can use it as-is. */
+ else if (is_gimple_min_invariant (tem))
+ ;
/* In rare cases range->exp can be equal to lhs of stmt.
In that case we have to insert after the stmt rather then before
it. If stmt is a PHI, insert it at the start of the basic block. */
this is resolved (but we still get the intermediate 1 & 1 created). Jakub,
you know this code more(?), can you see whether there's a better place to
handle this?
I'm testing the niter fortification.
More information about the Gcc-bugs
mailing list