[llvm-bugs] [Bug 37292] New: Loop to clear bits is not eliminated

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 30 04:49:02 PDT 2018


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

            Bug ID: 37292
           Summary: Loop to clear bits is not eliminated
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hello,

Loop in the function "test" can be eliminated.

unsigned test() {
    unsigned a = 2;
    unsigned bits = 1;

    while (a != 0) {
        a &= ~bits;
        bits <<= 1;
    }

    return 0;
}



Also godbolt:
https://godbolt.org/g/DHoZdn (intel icc can optimize this away)

Thanks

-- 
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/20180430/d31104ed/attachment.html>


More information about the llvm-bugs mailing list