Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assertion in LICM doFinalization()
The doFinalization method checks that the LoopToAliasSetMap is empty. LICM populates that map as it runs through the loop nest, deleting the entries for child loops as it goes. However, if a child loop is deleted by another pass (e.g. unrolling) then the loop will never be deleted from the map because LICM walks the loop nest to find entries it can delete. The fix is to delete the loop from the map and free the alias set when the loop is deleted from the loop nest. Differential Revision: http://reviews.llvm.org/D5305 llvm-svn: 218387
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
llvm/test/Transforms/LICM/2014-09-10-doFinalizationAssert.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; RUN: opt < %s -scalar-evolution -licm -loop-unroll -disable-output | ||
; Test triggered an assertion in doFinalization() because loop unroll was deleting | ||
; the inner loop which caused the loop to not get removed from the | ||
; LoopToAliasSetMap. | ||
; Test case taken from test/Transforms/LoopUnroll/unloop.ll. | ||
|
||
declare i1 @check() nounwind | ||
define void @skiplevelexit() nounwind { | ||
entry: | ||
br label %outer | ||
|
||
outer: | ||
br label %inner | ||
|
||
inner: | ||
%iv = phi i32 [ 0, %outer ], [ %inc, %tail ] | ||
%inc = add i32 %iv, 1 | ||
call zeroext i1 @check() | ||
br i1 true, label %outer.backedge, label %tail | ||
|
||
tail: | ||
br i1 false, label %inner, label %exit | ||
|
||
outer.backedge: | ||
br label %outer | ||
|
||
exit: | ||
ret void | ||
} | ||
|