[llvm-bugs] [Bug 40149] New: Assumptions without constant operands are not propagated

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 24 02:35:24 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40149

            Bug ID: 40149
           Summary: Assumptions without constant operands are not
                    propagated
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at lists.llvm.org

For icmps that don't have a constant operand, assumptions are not propagated.
For example, in the following test case %c1 implies that %c2 is false.

define i1 @test(i32 %x, i32 %y) {
  %c1 = icmp ult i32 %x, %y
  call void @llvm.assume(i1 %c1)
  %c2 = icmp ugt i32 %x, %y
  ret i1 %c2
}
declare void @llvm.assume(i1)

Something like this will only get simplified if either
a) the icmps match exactly, so they are CSEd, or
b) the icmps are inverses of either other and canonicalization is possible
(after which they're CSEd).

I'm not sure which pass should be responsible for this. I think right now it
would be easy and cheap to do in SCCP because it already computes
PredicateInfo, but it's not really the right pass to do this semantically.

-- 
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/20181224/532a475e/attachment.html>


More information about the llvm-bugs mailing list