forked from rust-lang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DAE] MarkLive in MarkValue(MaybeLive) if any use is live (rust-lang#82)
While looping through all args or all return values, we may mark a use of a later iteration as live. Previously when we got to that later value it would ignore that and continue adding to Uses instead of marking it live. For example, when looping through arg#0 and arg#1, MarkValue(arg#0, Live) may cause some use of arg#1 to be live, but MarkValue(arg#1, MaybeLive) will not notice that and continue adding into Uses. Now MarkValue(RA, MaybeLive) will MarkLive(RA) if any use is live. Fixes PR47444. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D88529 Co-authored-by: Arthur Eubanks <aeubanks@google.com>
- Loading branch information
Showing
3 changed files
with
53 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; RUN: opt -S -deadargelim %s | FileCheck %s | ||
|
||
define internal { i64, i64 } @f(i64 %a, i64 %b) { | ||
start: | ||
%0 = insertvalue { i64, i64 } undef, i64 %a, 0 | ||
%1 = insertvalue { i64, i64 } %0, i64 %b, 1 | ||
ret { i64, i64 } %1 | ||
} | ||
|
||
; Check that we don't delete either of g's return values | ||
|
||
; CHECK-LABEL: define internal { i64, i64 } @g(i64 %a, i64 %b) | ||
define internal { i64, i64 } @g(i64 %a, i64 %b) { | ||
start: | ||
%0 = call { i64, i64 } @f(i64 %a, i64 %b) | ||
ret { i64, i64 } %0 | ||
} | ||
|
||
declare dso_local i32 @test(i64, i64) | ||
|
||
define i32 @main(i32 %argc, i8** %argv) { | ||
start: | ||
%x = call { i64, i64 } @g(i64 13, i64 42) | ||
%x.0 = extractvalue { i64, i64 } %x, 0 | ||
%x.1 = extractvalue { i64, i64 } %x, 1 | ||
%z = bitcast i64 %x.0 to i64 | ||
%y = call { i64, i64 } @f(i64 %x.0, i64 %x.1) | ||
%y.1 = extractvalue { i64, i64 } %y, 1 | ||
%0 = call i32 @test(i64 %x.0, i64 %y.1) | ||
ret i32 %0 | ||
} | ||
|