[llvm-bugs] [Bug 34313] New: Unswitching does not catch opportunity with -fexperimental-new-pass-manager

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 24 11:57:00 PDT 2017


            Bug ID: 34313
           Summary: Unswitching does not catch opportunity with
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: chandlerc at gmail.com
          Reporter: stefanp at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org

With the following test code:

int has_utf8 = 1;
const char AA[] = {
  0, 1, 2, 3, 156, 9, 134, 17

int main() {
  long i, count=0, num=22;
  for (i=0; i<100000000; i++) {
    num = i % 7;
    if (!has_utf8 && AA[num] < 0x4)
  return count;

we can move the "if (!has_utf8)" outside of the loop and not run the loop at
all when has_utf8 = 1. 
The opportunity is caught correctly with the old pass manager but not with the
new one. 
Found with these options:
-m64 -mcpu=power8 -O3
Not found with these ones:
-m64 -mcpu=power8 -O3 -fexperimental-new-pass-manager

I did try the new unswitching pass from this patch:
but the compiler still did not find the opportunity.

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/20170824/f4ec9fff/attachment.html>

More information about the llvm-bugs mailing list