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

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

Reply via email to