[llvm-bugs] [Bug 31801] New: changeToUnreachable makes questionable decisions (and modifies the CFG)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 30 07:12:58 PST 2017


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

            Bug ID: 31801
           Summary: changeToUnreachable makes questionable decisions (and
                    modifies the CFG)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: chandlerc at gmail.com, dberlin at dberlin.org,
                    filcab at gmail.com, Florian.Hahn at arm.com,
                    llvm-bugs at lists.llvm.org, llvm-dev at redking.me.uk,
                    simon.f.whittaker at gmail.com
    Classification: Unclassified

Some recent changes in NewGVN revealed a couple of issues in
changeToUnreachable().
1) It's declared in Local.h, although it modifies the CFG (it shouldn't :().
2) It takes a `preserveLCSSA` boolean argument which prevents removal of
useless PHI nodes (the argument is passed down to
BasicBlock::removePredecessor). As discussed with Danny, this doesn't seem
enough to preserve LCSSA, but it could just be that the arugment of the
function is misnamed.

We should:
1) Modify the function so that it preserves the CFG
Danny suggested we could probably just insert before the terminator

new StoreInst(UndefValue::get(Int8Ty), Constant::getNullValue(Int8Ty\
getPointerTo()), TI)

so that SimplifyCFG knows how to remove it.

2) Understand how `preserveLCSSA` is used, and either fix to really preserve
LCSSA or change the parameter name (and document it, while we're there:)

-- 
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/20170130/c4b5d1e5/attachment-0001.html>


More information about the llvm-bugs mailing list