[llvm-bugs] [Bug 46850] New: Missed exception call elimination

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 25 11:11:53 PDT 2020


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

            Bug ID: 46850
           Summary: Missed exception call elimination
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Initially posted at rust github: https://github.com/rust-lang/rust/issues/65969

Code:
https://github.com/rust-lang/rust/issues/65969

#include <vector>

int foo(std::vector<int> const& a, std::vector<int> const& b) {
    int index = 0;
    int x = 0;
    for (int i = 0; i < a.size(); i++) {
        for (int j = 0; j < b.size(); i++) {
            if (i == j) {
                // llvm cannot eliminate exception call "out of range"
                // gcc can
                x = a.at(index);
                index += 1;
                break;
            }
        }
    }
    return x;
}

Godbolt: https://godbolt.org/z/sxGhMW

-- 
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/20200725/1791bd88/attachment-0001.html>


More information about the llvm-bugs mailing list