-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
229 additions
and
42 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
45 changes: 45 additions & 0 deletions
45
llvm/test/Transforms/DeadStoreElimination/inter-procedural.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,45 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt < %s -passes=function-attrs,dse -enable-dse-initializes-attr-improvement -S | FileCheck %s | ||
|
||
; Function Attrs: mustprogress nounwind uwtable | ||
define void @write_only_arg(ptr nocapture noundef writeonly initializes((0, 2)) %ptr) { | ||
store i16 100, ptr %ptr | ||
ret void | ||
} | ||
|
||
; Function Attrs: mustprogress nounwind uwtable memory(none argmem: readwrite) | ||
define i16 @write_then_read_arg(ptr nocapture noundef initializes((0, 2)) %ptr) { | ||
store i16 10, ptr %ptr | ||
%l = load i16, ptr %ptr | ||
ret i16 %l | ||
} | ||
|
||
; Function Attrs: mustprogress nounwind uwtable | ||
define i16 @write_only_caller() { | ||
; CHECK-LABEL: @write_only_caller( | ||
; CHECK-NEXT: %ptr = alloca i16, align 2 | ||
; CHECK-NEXT: call void @write_only_arg(ptr %ptr) | ||
; CHECK-NEXT: %l = load i16, ptr %ptr | ||
; CHECK-NEXT: ret i16 %l | ||
; | ||
%ptr = alloca i16 | ||
store i16 0, ptr %ptr | ||
call void @write_only_arg(ptr %ptr) | ||
%l = load i16, ptr %ptr | ||
ret i16 %l | ||
} | ||
|
||
; Function Attrs: mustprogress nounwind uwtable | ||
define i16 @write_then_read_caller() { | ||
; CHECK-LABEL: @write_then_read_caller( | ||
; CHECK-NEXT: %ptr = alloca i16, align 2 | ||
; CHECK-NEXT: %call = call i16 @write_then_read_arg(ptr %ptr) | ||
; CHECK-NEXT: %l = load i16, ptr %ptr | ||
; CHECK-NEXT: ret i16 %l | ||
; | ||
%ptr = alloca i16 | ||
store i16 0, ptr %ptr | ||
%call = call i16 @write_then_read_arg(ptr %ptr) | ||
%l = load i16, ptr %ptr | ||
ret i16 %l | ||
} |