[llvm-bugs] [Bug 30375] New: Regression in Clang-4.0.0's optimizer

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 13 18:00:06 PDT 2016


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

            Bug ID: 30375
           Summary: Regression in Clang-4.0.0's optimizer
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

We compiled a program (A.c) by clang-4.0.0 and clang-3.6.2 with -O3 option.
clang-3.6.2 performed better optimization than clang-4.0.0.

(A.c)
int x0 = 1;
int main ()
{
  int x1 = 1;
  int t0 = 2 / ((1 / x0) && x1);
  if (t0 != 2) __builtin_abort();
  return 0;
}

+-------------------------------+--------------------------------+
|clang-4.0.0.s                  |clang-3.6.2.s                   |
|(clang-4.0.0 A.c -O3 -S)       |(clang-3.6.2 A.c -O3 -S)        |
+-------------------------------+--------------------------------+
|main:                          |main:                           |
|        .cfi_startproc         |        .cfi_startproc          |
|# BB#0:                        |# BB#0:                         |
|        movl    x0(%rip), %eax |                                |
|        leal    1(%rax), %ecx  |                                |
|        cmpl    $3, %ecx       |                                |
|        sbbb    %cl, %cl       |                                |
|        testl   %eax, %eax     |                                |
|        setne   %al            |                                |
|        andb    %cl, %al       |                                |
|        movzbl  %al, %ecx      |                                |
|        movl    $2, %eax       |                                |
|        xorl    %edx, %edx     |                                |
|        divl    %ecx           |                                |
|        cmpl    $2, %eax       |                                |
|        jne     .LBB0_2        |                                |
|# BB#1:                        |                                |
|        xorl    %eax, %eax     |        xorl    %eax, %eax      |
|        retq                   |        retq                    |
|.LBB0_2:                       |                                |
|        pushq   %rax           |                                |
|.Ltmp0:                        |.Ltmp0:                         |
|        .cfi_def_cfa_offset 16 |        .size   main, .Ltmp0-...|
|        callq   abort          |                                |
|.Lfunc_end0:                   |                                |
|        .size   main, .Lfunc...|                                |
|        .cfi_endproc           |        .cfi_endproc            |
|                               |                                |
|        .type   x0, at object     |        .type   x0, at object      |
|        .data                  |        .data                   |
|        .globl  x0             |        .globl  x0              |
|        .p2align        2      |        .align  4               |
|x0:                            |x0:                             |
|        .long   1              |        .long   1               |
|        .size   x0, 4          |        .size   x0, 4           |
|                               |                                |
|                               |                                |
|        .ident  "clang versi...|        .ident  "Ubuntu clang...|
|        .section        ".no...|        .section        ".not...|
+-------------------------------+--------------------------------+

using built-in specs.
clang version 4.0.0 (https://github.com/llvm-mirror/clang.git
359c45534e46a8ef263db1a8b855740bbeca6998)
(https://github.com/llvm-mirror/llvm.git
990fea5450379639c1e21f456d44a9e95eabaff3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

using built-in specs.
Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

-- 
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/20160914/9470abfc/attachment.html>


More information about the llvm-bugs mailing list