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

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

Reply via email to