[llvm-bugs] [Bug 48761] New: [Machine Block Placement] wrong code with -force-loop-cold-block

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 15 10:01:17 PST 2021


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

            Bug ID: 48761
           Summary: [Machine Block Placement]  wrong code with
                    -force-loop-cold-block
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24382
  --> https://bugs.llvm.org/attachment.cgi?id=24382&action=edit
reduced testcase

This program should execute the inner loop in c() once and therefore print '5'.

volatile int a = 0, b = 1;
void c() {
  for (; b < 2; b++)
    for (; a < 5; a++)
      ;
}
int main() {
  c();
  printf("%d\n", a);
}

However, with -force-loop-cold-block, it prints 0, because it moves the outer
latch up to before the outer loop, increments b first, and then directly exits
since b is now 2...

llc -mcpu=arch13 tc.mir -run-pass=block-placement -force-loop-cold-block

-- 
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/20210115/0aef2c3d/attachment.html>


More information about the llvm-bugs mailing list