[llvm-bugs] [Bug 48038] New: Clang fails to optimise loop invariant when function accesses class members

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 1 14:18:29 PST 2020


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

            Bug ID: 48038
           Summary: Clang fails to optimise loop invariant when function
                    accesses class members
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: robin.christ at gmx.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Repro is here:
https://godbolt.org/z/Y8397j

Essentially we're seeing a division in every loop iteration for the trivial
HanningWindow::prepare1 case.
If we cache the flow_ and fhigh_ class members (HanningWindow::prepare2), the
invariant gets optimised.
Same if we extract the function (prepareExternal)

prepare1 => .LBB1_2: doesn't get optimised
prepare2 => .LBB2_2: works as expected
prepareExternal => .LBB3_2 works as expected


Any ideas why this happens? Is this something that can be fixed?

-- 
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/20201101/ac8fdfcf/attachment.html>


More information about the llvm-bugs mailing list