https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116887
--- Comment #7 from chenglulu <chenglulu at loongson dot cn> ---
I trimmed the test case and found that the error was caused by the following
statement:
;; basic block 8, loop depth 1
;; pred: 7
if (l_7 == &_rtld_globalD.3739._dl_rtld_mapD.3732)
goto <bb 9>; [INV]
else
goto <bb 10>; [INV]
;; succ: 9
The following patches can fix the problem, but I don't know the exact reason
yet.
diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index f956ee4b119..3438eafaedc 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -2529,7 +2529,7 @@ loongarch_const_insns (rtx x)
{
if (IMM12_INT (offset))
return n + 1;
- else if (!targetm.cannot_force_const_mem (GET_MODE (x), x))
+ else
return n + 1 + loongarch_integer_cost (INTVAL (offset));
}
}