Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstCombine] Fix debug variance issue in tryToMoveFreeBeforeNullTest
Fix an issue where the presence of debug info could disable an optimization in tryToMoveFreeBeforeNullTest.
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
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
22 changes: 22 additions & 0 deletions
22
llvm/test/Transforms/InstCombine/malloc-free-delete-dbginvar.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,22 @@ | ||
; Check that the instcombine result is the same with/without debug info. | ||
; This is a regression test for a function taken from malloc-free-delete.ll. | ||
|
||
; RUN: opt < %s -instcombine -S > %t.no_dbg.ll | ||
; RUN: opt < %s -debugify-each -instcombine -S > %t.ll | ||
; RUN: diff %t.no_dbg.ll %t.ll | ||
|
||
declare void @free(i8*) | ||
|
||
define void @test12(i32* %foo) minsize { | ||
entry: | ||
%tobool = icmp eq i32* %foo, null | ||
br i1 %tobool, label %if.end, label %if.then | ||
|
||
if.then: ; preds = %entry | ||
%bitcast = bitcast i32* %foo to i8* | ||
tail call void @free(i8* %bitcast) | ||
br label %if.end | ||
|
||
if.end: ; preds = %entry, %if.then | ||
ret void | ||
} |