[llvm-bugs] [Bug 49001] New: Failure to optimize out indirect access to unused variable

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 2 08:35:40 PST 2021


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

            Bug ID: 49001
           Summary: Failure to optimize out indirect access to unused
                    variable
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

void f(bool x)
{
    int a, b;
    *(x ? &a : &b) = 0;
}

This can be optimized to doing nothing. This transformation is done by GCC, but
not by LLVM.

Godbolt comparison here: https://godbolt.org/z/8Grfjd
(I think an alive2 link would be useless here, considering it's not really
applicable to this kind of stuff)

-- 
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/20210202/5d80f5ff/attachment-0001.html>


More information about the llvm-bugs mailing list