[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497 --- Comment #10 from Andrew Pinski --- CLANG/LLVM does this while ICC peels off the first iteration of the loop.
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497 Richard Biener changed: What|Removed |Added Last reconfirmed|2010-03-03 10:57:32 |2017-6-26 --- Comment #9 from Richard Biener --- I think the issue is we are not able to value-number both loads of *a to the same value because DoHuffIteration clobbers *a. So the *a in the block leading to exit and the *a inserted in the latch do not have the same value. I don't see how we can fix that easily inside PRE - we'd have to somehow fix the value-numbering done during PHI translation to catch this case. Iterating VN/PRE makes the value-numbering part work but hoisting still fails because we look at ANTIC_IN & ~AVAIL_OUT but *a_6(D) is cleared from ANTIC_OUT(3) as DoHuffIteration clobbers it. So we really want to look at ANTIC_OUT & ~AVAIL_OUT in do_hoist_insertion (ANTIC_IN is a good approximation but it doesn't work here). Of course ANTIC_OUT we'd have to re-compute as we don't retain it. There's the slight complication that hoist insertion possibly inserts before the last stmt though (that makes using ANTIC_IN a "fix" for that stmt possibly clobbering the value). Anyway, w/o fixing the value-numbering part fixing hoisting is pointless of course.
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497 --- Comment #8 from Andrew Pinski --- (In reply to Richard Biener from comment #5) > now what is left is hoisting *a_2(D) to after the call. But that's not PRE. Yes I agree with this but hoisting was added to PRE and we still don't optimize it ...
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #7 from rguenth at gcc dot gnu dot org 2010-05-05 10:30 --- As *a_2(D) is ANTIC_OUT in bb3 (but not ANTIC_IN in bb3 because it dies in there) can we insert in bb3 instead of in bb5? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #3 from rguenth at gcc dot gnu dot org 2010-03-03 10:43 --- This isn't PRE but code hoisting which we have a dup for. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added CC||stevenb dot gcc at gmail dot ||com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #4 from steven at gcc dot gnu dot org 2010-03-03 10:57 --- I think pinskia means we could transform the test case of comment #0 to: void DoHuffIteration(int); int f(int *a) { int i; int plaintextlen=*a; pretmp = plaintextlen; for(i = 0; i 1; i++) { DoHuffIteration(pretmp); pretmp = *a; } return pretmp - plaintextlen; } which makes this PRE, not hoisting. -- steven at gcc dot gnu dot org changed: What|Removed |Added CC|stevenb dot gcc at gmail dot| |com | Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-03-03 10:57:32 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #5 from rguenth at gcc dot gnu dot org 2010-03-03 11:03 --- I'm not so sure. We start with bb 2: plaintextlen_3 = *a_2(D); bb 3: # i_13 = PHI i_6(5), 0(2) D.2725_5 = *a_2(D); DoHuffIteration (D.2725_5); i_6 = i_13 + 1; if (i_6 = ) goto bb 5; else goto bb 4; bb 5: goto bb 3; bb 4: D.2725_7 = *a_2(D); so *a_2 (4) is antic-out in bb3 but dies in bb3 (thus it's not antic-in there). *a_2 (3) is antic-in in bb5 and available in bb2. Thus we insert in bb5: bb 2: plaintextlen_3 = *a_2(D); bb 3: # i_13 = PHI i_6(5), 0(2) # prephitmp.3_14 = PHI pretmp.2_1(5), plaintextlen_3(2) D.2725_5 = prephitmp.3_14; DoHuffIteration (D.2725_5); i_6 = i_13 + 1; if (i_6 = ) goto bb 5; else goto bb 4; bb 5: pretmp.2_1 = *a_2(D); goto bb 3; bb 4: D.2725_7 = *a_2(D); now what is left is hoisting *a_2(D) to after the call. But that's not PRE. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #6 from steven at gcc dot gnu dot org 2010-03-03 14:26 --- Well, it is not hoisting, either. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #2 from pinskia at gcc dot gnu dot org 2010-03-02 19:01 --- Still happens as of today on the trunk. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497
[Bug tree-optimization/38497] PRE missing a load PRE which causes a loop to have two BBs
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-12-11 23:24 --- This is a reduced testcase from The huffman byte benchmark. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38497