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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to