[llvm-branch-commits] [llvm-branch] r295748 - Merging r293273:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 21 11:01:56 PST 2017


Author: hans
Date: Tue Feb 21 13:01:56 2017
New Revision: 295748

URL: http://llvm.org/viewvc/llvm-project?rev=295748&view=rev
Log:
Merging r293273:
------------------------------------------------------------------------
r293273 | chandlerc | 2017-01-27 02:27:32 -0800 (Fri, 27 Jan 2017) | 19 lines

[LICM] When we are recomputing the alias sets for a subloop, we cannot
skip sub-subloops.

The logic to skip subloops dated from when this code was shared with the
cached case. Once it was factored out to only run in the case of
recomputed subloops it became a dangerous bug. If a subsubloop contained
an interfering instruction it would be silently skipped from the alias
sets for LICM.

With the old pass manager this was extremely hard to trigger as it would
require failing to visit these subloops with the LICM pass but then
visiting the outer loop somehow. I've not yet contrived any test case
that actually manages to trigger this.

But with the new pass manager we don't do the cross-loop caching hack
that the old PM does and so we recompute alias set information from
first principles. While this seems much cleaner and simpler it exposed
this bug and would subtly miscompile code due to failing to correctly
model the aliasing constraints of deeply nested loops.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_40/   (props changed)
    llvm/branches/release_40/lib/Transforms/Scalar/LICM.cpp

Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 13:01:56 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230,295486,295490,295512
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293273,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230,295486,295490,295512

Modified: llvm/branches/release_40/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/Transforms/Scalar/LICM.cpp?rev=295748&r1=295747&r2=295748&view=diff
==============================================================================
--- llvm/branches/release_40/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/branches/release_40/lib/Transforms/Scalar/LICM.cpp Tue Feb 21 13:01:56 2017
@@ -1196,10 +1196,7 @@ LoopInvariantCodeMotion::collectAliasInf
 
   auto mergeLoop = [&](Loop *L) {
     // Loop over the body of this loop, looking for calls, invokes, and stores.
-    // Because subloops have already been incorporated into AST, we skip blocks
-    // in subloops.
     for (BasicBlock *BB : L->blocks())
-      if (LI->getLoopFor(BB) == L) // Ignore blocks in subloops.
         CurAST->add(*BB);          // Incorporate the specified basic block
   };
 




More information about the llvm-branch-commits mailing list