[llvm-bugs] [Bug 47170] New: Sink instructions to their earliest usage site
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 14 10:54:47 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47170
Bug ID: 47170
Summary: Sink instructions to their earliest usage site
Product: new-bugs
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hiraditya at msn.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
GVNSink can be improved to have this optimization.
https://reviews.llvm.org/D37762
Test case from the patch:
```
define i32 @test4(i1 %C, i1 %D, i1 %E, i32 %A) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ENDIF:%.*]]
; CHECK: then:
; CHECK-NEXT: [[OR1:%.*]] = or i32 [[A:%.*]], 65537
; CHECK-NEXT: [[SELECT1:%.*]] = select i1 [[D:%.*]], i32 [[OR1]], i32 [[A]]
; CHECK-NEXT: [[OR2:%.*]] = or i32 [[SELECT1]], 131074
; CHECK-NEXT: [[SELECT2:%.*]] = select i1 [[E:%.*]], i32 [[OR2]], i32
[[SELECT1]]
; CHECK-NEXT: ret i32 [[SELECT2]]
; CHECK: endif:
; CHECK-NEXT: ret i32 [[A]]
;
%or1 = or i32 %A, 65537
%select1 = select i1 %D, i32 %or1, i32 %A
%or2 = or i32 %select1, 131074
%select2 = select i1 %E, i32 %or2, i32 %select1
br i1 %C, label %then, label %endif
then:
ret i32 %select2
endif:
ret i32 %A
}
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200814/b80ba6eb/attachment.html>
More information about the llvm-bugs
mailing list