[llvm-bugs] [Bug 27296] New: LVI should understand conditional branches where the condition is a conjunction or disjunction

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 8 12:35:25 PDT 2016


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

            Bug ID: 27296
           Summary: LVI should understand conditional branches where the
                    condition is a conjunction or disjunction
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: regehr at cs.utah.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

LVI is perfectly capable of learning from sequenced simple branches:

  %cmp = icmp sgt i32 %x, 20
  br i1 %cmp, label %cont, label %if.end3
  %cmp1 = icmp sgt i32 %y, 200
  br i1 %cmp1, label %if.then2, label %if.end3
  %add = add nsw i32 %y, %x

However, after SimplifyCFG we're instead looking at code like this:

  %cmp = icmp sgt i32 %x, 20
  %cmp1 = icmp sgt i32 %y, 200
  %or.cond = and i1 %cmp, %cmp1
  br i1 %or.cond, label %if.then2, label %if.end3

And now LVI learns nothing. A mix would be to cause LVI to look for cases where
an i1 that goes to a branch is the result of an and, and recursively accumulate
dataflow facts.

Though it's probably less important, LVI can also learn facts when flags are
or'ed, for example:

  %cmp = icmp eq i32 %x, 10
  %cmp1 = icmp eq i32 %x, 12
  %or.cond = or i1 %cmp, %cmp1
  br i1 %or.cond, label %if.then2, label %if.end3

-- 
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/20160408/1ef9d967/attachment.html>


More information about the llvm-bugs mailing list