[llvm-bugs] [Bug 50425] New: instcombine transform ruins simplifycfg if-then to select optimization
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 20 15:02:06 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50425
Bug ID: 50425
Summary: instcombine transform ruins simplifycfg if-then to
select optimization
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: valery.n.dmitriev at intel.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
I recently encountered a case where instcombine transform
icmp (A-B), (C-B) -> icmp A, C
affects simplifycfg ability to fold if-then into a select.
Here is test case:
; begin
target triple = "x86_64-unknown-linux-gnu"
define dso_local void @foo(i32* %p1, i32* %p2, i32 %g, i32 %gh) {
entry:
%i2 = load i32, i32* %p1, align 4
%sub17 = sub nsw i32 %i2, %gh
store i32 %sub17, i32* %p1, align 4
%i3 = load i32, i32* %p2, align 4
%i20 = add nsw i32 %i3, %g
%sub21 = sub nsw i32 %i20, %gh
%cmp24 = icmp slt i32 %sub17, %sub21
br i1 %cmp24, label %if.then25, label %if.end28
if.then25:
store i32 %sub21, i32* %p1, align 4
br label %if.end28
if.end28:
br label %end
end:
ret void
}
; end
To reproduce compare
opt -S -instcombine -simplifycfg test.ll
versus
opt -S -simplifycfg test.ll
At first glance it may appear as if instcombine sinking creates an issue for
simplifycfg
but even with -instcombine-code-sinking=false option simplifycfg does not fold
if-then:
https://alive2.llvm.org/ce/z/sYXoZO
--
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/20210520/ea4eb919/attachment.html>
More information about the llvm-bugs
mailing list