[Bug tree-optimization/94734] [10 Regression] Program crashes when compiled with -O2 since r10-1892-gb9ef6a2e04bfd013
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 24 00:48:18 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94734
--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
THe whole point of that change is to not require a dominating load if the
object comes from the stack.
We conditionally load from the same location, then have a PHI which selects
that loaded value or "1" and we store the result. That's precisely what is
supposed to be happening.
The loop in question looks like:
;; basic block 3, loop depth 1
;; pred: 2
;; 6
# ivtmp.13_9 = PHI <0(2), ivtmp.13_7(6)>
_4 = MEM[base: in_21(D), index: ivtmp.13_9, step: 8, offset: 0B];
if (_4 == 0B)
goto <bb 13>; [5.50%]
else
goto <bb 4>; [94.50%]
;; succ: 13
;; 4
;; basic block 4, loop depth 1
;; pred: 3
if (ivtmp.13_9 != 2)
goto <bb 6>; [28.10%]
else
goto <bb 5>; [71.90%]
;; succ: 6
;; 5
;; basic block 5, loop depth 1
;; pred: 4
cstore_32 = MEM[symbol: arr, index: ivtmp.13_9, step: 4, offset: 0B];
;; succ: 6
;; basic block 6, loop depth 1
;; pred: 5
;; 4
# cstore_31 = PHI <cstore_32(5), 1(4)>
MEM[symbol: arr, index: ivtmp.13_9, step: 4, offset: 0B] = cstore_31;
_40 = (unsigned int) ivtmp.13_9;
_38 = _40 + 1;
_37 = (int) _38;
ivtmp.13_7 = ivtmp.13_9 + 1;
sum_a_27 = (int) ivtmp.13_7;
if (n_16(D) > sum_a_27)
goto <bb 3>; [94.50%]
else
goto <bb 7>; [5.50%]
;; succ: 3
;; 7
You can see the load from the same stock slot in bb5, the selecting PHI in bb6
and the store in bb6.
THe test in bb4 looks weird and is the source of the problem I believe.
More information about the Gcc-bugs
mailing list