[llvm-bugs] [Bug 33409] New: instcombine folds branchs on constant conditions to undef

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 11 16:31:24 PDT 2017


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

            Bug ID: 33409
           Summary: instcombine folds branchs on constant conditions to
                    undef
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: dberlin at dberlin.org, llvm-bugs at lists.llvm.org,
                    nunoplopes at sapo.pt, regehr at cs.utah.edu,
                    sanjoy at playingwithpointers.com

This is something I found out while debugging another MemSSA problem. Not a
proper bug, but something I found surprising.

Given: 

@b = external global i32

define void @patatino() {
for.cond:
  br i1 true, label %if.end, label %for.inc

if.end:                                           ; preds = %for.cond
  %tinkywinky = load i32, i32* @b
  br i1 true, label %for.inc, label %for.inc

for.inc:                                          ; preds = %if.end, %if.end,
%for.cond
  ret void
}

The terminator in `if.end`  after instcombine becomes:
`  br i1 undef, label %for.inc, label %for.inc `

IC: Visiting:   br i1 true, label %for.inc, label %for.inc
IC: Mod =   br i1 true, label %for.inc, label %for.inc
    New =   br i1 undef, label %for.inc, label %for.inc


This transformation is not useful. Replacing true with undef doesn't really
help anything (SimplifyCFG should be able to fold branches when the condition
is constant).

-- 
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/20170611/e921164f/attachment.html>


More information about the llvm-bugs mailing list