<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93713>93713</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-reduce should remove lifetime.start/end when promoting alloca'd ptr to arg
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm-reduce
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ManuelJBrito
</td>
</tr>
</table>
<pre>
Lifetime.start/end in general should only be used for alloca'd pointers. When running the "operands-to-args" pass the lifetimes should be dropped.
```llvm
define void @src() {
entry:
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr %p)
store i32 10, ptr %p, align 4
%a = load i32, ptr %p, align 4
call void @llvm.lifetime.end.p0(i64 4, ptr %p)
ret void
}
```
Running llvm-reduce --delta-passes=operands-to-args --test=test.sh src.ll
```llvm
; ModuleID = 'src.ll'
source_filename = "src.ll"
define void @src(ptr %p) {
entry:
%p1 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr %p)
store i32 10, ptr %p, align 4
%a = load i32, ptr %p, align 4
call void @llvm.lifetime.end.p0(i64 4, ptr %p)
ret void
}
```
cc @nunoplopes @regehr
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVE2PnDgQ_TXmUgJBGZrmwGF6UUu72rnsZY-RwdXgyG0j23Q0_z4y0JmeSTLJD4iEZNk8v1cfzyW8V6Mhall1YlWXiCVM1rXPwiyk_zk5FWzSW_nS_qsuFNSVMh-ECwzPZCQoAyMZckKDn-yiJVijX6AnWDxJuFgHQms7CIa1hNkqE8j5DP6fyIBbjFFmhDARMEQ7kxNG-jTYVLjRM0SYhffrf72r-7tOTyCdnWeSGcs7lj-xQ759Wt-u25GkizIEN6sksDL3bmB4ZNgAq08bgkxwL4w_bTsAhtUMjHd71KA4MvwLhFajgfKOGoTW31ijXKbfFCebc4ZHdSihjLfn4FZihs2dwQfrKLJDkb-FfCfGsBJrSNoKeQ_oA_wHwZGRvw7NUViv71Wtu3fl3bb_7b2LAqkjuQwEaSpJB5HGppFnvHvfUUjTQD4w3sUl8xN4N2Ra7wo_ayPjJ3i2ctH0d7dWgmG9X8R6g3i7uIE-XZQmI660o_COwkeFH7rioRAfu6P4Y4_fsMcwRHqzGDtrO5OPO0cjTQ4S2XLZ8EYk1BZ1Ued5WRdlMrUH4kVRH_iF6osUx-GITSXqqhdYcSHqPFEt5ljmFTZFXVZFmTVlI4j3Ahspi7zgrMzpKpTO1rysGxPl_UJtw-uCJ1r0pP065xAffBvtUXWJa9ezfhl9rIzywb_yBBU0tY9m38eQo6u9vY6nN8PxSxxys7NXG-JTeRyEwUGwINyYLE63Uwizjz7DM8PzqMK09NlgrwzP6yvYlnR29jMNkX1NyzM8b5ndWvwaAAD__xRCu-4">