Files
clang-p2996/llvm/test/Transforms/DeadStoreElimination/dependent-capture.ll
Arthur Eubanks 13aa2c1c3b [DSE] Revisit pointers that may no longer escape after removing another store
In dependent-capture, previously we'd see that %tmp4 is captured due to
the first store. We'd cache this info in CapturedBeforeReturn and
InvisibleToCallerAfterRet. Then the first store is then removed, causing
the cached values to be wrong.

We also need to revisit everything because normally we work backwards
when removing stores at the end of the function, but in this case
removing an earlier store causes a later store to be removable.

No compile time impact:
https://llvm-compile-time-tracker.com/compare.php?from=56796ae1a8db4c85dada28676f8303a5a3609c63&to=21b7e5248ffc423cd36c9d4a020085e363451465&stat=instructions

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D123686
2022-07-19 09:30:34 -07:00

18 lines
472 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=dse -S < %s | FileCheck %s
define void @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT: [[TMP1:%.*]] = call noalias ptr @_Znwm()
; CHECK-NEXT: [[TMP4:%.*]] = call noalias ptr @_Znwm()
; CHECK-NEXT: ret void
;
%tmp1 = call noalias ptr @_Znwm()
%tmp4 = call noalias ptr @_Znwm()
store ptr %tmp4, ptr %tmp1
store i8 0, ptr %tmp4, align 1
ret void
}
declare ptr @_Znwm()