1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/DeadArgElim/preserve-used-ret.ll
Arthur Eubanks 45cb3d9d33 [DAE] MarkLive in MarkValue(MaybeLive) if any use is live
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
2020-10-02 10:55:08 -07:00

33 lines
862 B
LLVM

; 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
}