llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.42k stars 11.74k forks source link

[release_34] Multiple tests fail on PowerPC64 Linux #18377

Closed ismail closed 10 years ago

ismail commented 10 years ago
Bugzilla Link 18003
Resolution FIXED
Resolved on Dec 12, 2013 06:06
Version trunk
OS Linux
CC @hfinkel,@isanbard

Extended Description

Following tests fail on openSUSE 13.1 PPC64 with llvm 3.4rc1:

test/CodeGen/PowerPC/ppc32-vacopy.ll test/CodeGen/PowerPC/anon_aggr.ll test/CodeGen/PowerPC/2010-05-03-retaddr1.ll

Here is the output for each test:

###############################################################################

abuild@aqua:/home/abuild/rpmbuild/BUILD/llvm/stage2> /home/abuild/rpmbuild/BUILD/llvm/stage2/bin/./llc < /home/abuild/rpmbuild/BUILD/llvm/test/CodeGen/PowerPC/2010-05-03-retaddr1.ll -march=ppc32 -mtriple=powerpc-apple-darwin -mcpu=g5
.machine ppc970 .section TEXT,textcoal_nt,coalesced,pure_instructions .section TEXT,symbol_stub1,symbol_stubs,pure_instructions,16 .section TEXT,text,regular,pure_instructions .globl _g2 .align 4 _g2: ; @​g2 ; BB#0: ; %entry lwz r3, 0(r1) blr

    .globl  _g
    .align  4

_g: ; @​g ; BB#0: ; %entry mflr r0 li r3, 8 stw r0, 8(r1) lwz r2, 0(r1) lwzx r3, r2, r3 lwz r0, 8(r1) mtlr r0 blr

.subsections_via_symbols

###############################################################################

abuild@aqua:/home/abuild/rpmbuild/BUILD/llvm/stage2> /home/abuild/rpmbuild/BUILD/llvm/stage2/bin/./llc -O0 -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu -fast-isel=false < /home/abuild/rpmbuild/BUILD/llvm/test/CodeGen/PowerPC/anon_aggr.ll .file "" .text .globl func1 .align 2 .type func1,@function .section .opd,"aw",@progbits func1: # @​func1 .align 3 .quad .L.func1 .quad .TOC.@tocbase .quad 0 .text .L.func1: .cfi_startproc

BB#0: # %entry

    cmpld 0, 4, 5
    std 5, -8(1)                    # 8-byte Folded Spill
    std 4, -16(1)                   # 8-byte Folded Spill
    bne 0, .LBB0_2
    b .LBB0_1

.LBB0_1: # %equal ld 3, -16(1) # 8-byte Folded Reload blr .LBB0_2: # %unequal ld 3, -8(1) # 8-byte Folded Reload blr .long 0 .quad 0 .Ltmp0: .size func1, .Ltmp0-.L.func1 .cfi_endproc

    .globl  func2
    .align  2
    .type   func2,@function
    .section        .opd,"aw",@progbits

func2: # @​func2 .align 3 .quad .L.func2 .quad .TOC.@tocbase .quad 0 .text .L.func2: .cfi_startproc

BB#0: # %entry

    addi 3, 1, 64
    std 6, 72(1)
    std 5, 64(1)
    ld 3, 8(3)
    cmpld 0, 4, 3
    std 4, -8(1)                    # 8-byte Folded Spill
    std 3, -16(1)                   # 8-byte Folded Spill
    bne 0, .LBB1_2
    b .LBB1_1

.LBB1_1: # %equal ld 3, -8(1) # 8-byte Folded Reload blr .LBB1_2: # %unequal ld 3, -16(1) # 8-byte Folded Reload blr .long 0 .quad 0 .Ltmp1: .size func2, .Ltmp1-.L.func2 .cfi_endproc

    .globl  func3
    .align  2
    .type   func3,@function
    .section        .opd,"aw",@progbits

func3: # @​func3 .align 3 .quad .L.func3 .quad .TOC.@tocbase .quad 0 .text .L.func3: .cfi_startproc

BB#0: # %entry

    addi 7, 1, 64
    std 6, 72(1)
    std 5, 64(1)
    std 4, 56(1)
    std 3, 48(1)
    addi 3, 1, 48
    ld 4, 8(7)
    ld 3, 8(3)
    cmpld 0, 3, 4
    std 4, -8(1)                    # 8-byte Folded Spill
    std 3, -16(1)                   # 8-byte Folded Spill
    bne 0, .LBB2_2
    b .LBB2_1

.LBB2_1: # %equal ld 3, -16(1) # 8-byte Folded Reload blr .LBB2_2: # %unequal ld 3, -8(1) # 8-byte Folded Reload blr .long 0 .quad 0 .Ltmp2: .size func3, .Ltmp2-.L.func3 .cfi_endproc

    .globl  func4
    .align  2
    .type   func4,@function
    .section        .opd,"aw",@progbits

func4: # @​func4 .align 3 .quad .L.func4 .quad .TOC.@tocbase .quad 0 .text .L.func4: .cfi_startproc

BB#0: # %entry

    addi 3, 1, 128
    ld 4, 120(1)
    ld 3, 8(3)
    cmpld 0, 4, 3
    std 4, -8(1)                    # 8-byte Folded Spill
    std 3, -16(1)                   # 8-byte Folded Spill
    bne 0, .LBB3_2
    b .LBB3_1

.LBB3_1: # %equal ld 3, -8(1) # 8-byte Folded Reload blr .LBB3_2: # %unequal ld 3, -16(1) # 8-byte Folded Reload blr .long 0 .quad 0 .Ltmp3: .size func4, .Ltmp3-.L.func4 .cfi_endproc

###############################################################################

abuild@aqua:/home/abuild/rpmbuild/BUILD/llvm/stage2> /home/abuild/rpmbuild/BUILD/llvm/stage2/bin/./llc -mtriple="powerpc-unknown-linux-gnu" < /home/abuild/rpmbuild/BUILD/llvm/test/CodeGen/PowerPC/ppc32-vacopy.ll .file "" .text .globl test_vacopy .align 2 .type test_vacopy,@function test_vacopy: # @​test_vacopy

BB#0: # %entry

    stwu 1, -48(1)
    li 3, 8
    addi 4, 1, 32
    lwz 5, 32(1)
    addi 7, 1, 16
    lwzx 6, 4, 3
    lwz 4, 4(4)
    stw 5, 16(1)
    stwx 6, 7, 3
    stw 4, 4(7)
    addi 1, 1, 48
    blr

.Ltmp0: .size test_vacopy, .Ltmp0-test_vacopy

###############################################################################

ismail commented 10 years ago

As it turns out, this was an error in the PPC backend. Fixed in r197089. This should appear in the release.

Confirmed as fixed, thanks!

isanbard commented 10 years ago

As it turns out, this was an error in the PPC backend. Fixed in r197089. This should appear in the release.

Added into the release. Feel free to update the release notes!

hfinkel commented 10 years ago

As it turns out, this was an error in the PPC backend. Fixed in r197089. This should appear in the release.

hfinkel commented 10 years ago

No, this is actually quite serious. It means that clang miscompiles itself (with assertions disabled -- which exposes more optimization opportunities). I'm working on bisecting the problem now (I currently know that the bug was introduced somewhere in (r190260, r190314].

r190309 was the triggering commit.

hfinkel commented 10 years ago

No, this is actually quite serious. It means that clang miscompiles itself (with assertions disabled -- which exposes more optimization opportunities). I'm working on bisecting the problem now (I currently know that the bug was introduced somewhere in (r190260, r190314].

ismail commented 10 years ago

I guess this bug can be marked as invalid since disabling assertions are not really supported AFAIK. It was a mistake on my side to disable them.

ismail commented 10 years ago

For now I'll enable asserts. Thanks!

hfinkel commented 10 years ago

Okay, thanks!

At least on my system (with the aforementioned configuration), I see the following failures on a self-hosted release build.

LLVM :: CodeGen/PowerPC/2010-05-03-retaddr1.ll
LLVM :: CodeGen/PowerPC/anon_aggr.ll
LLVM :: CodeGen/PowerPC/ppc32-vacopy.ll
LLVM :: CodeGen/X86/dynamic-allocas-VLAs.ll
LLVM :: CodeGen/X86/force-align-stack.ll
LLVM :: CodeGen/X86/pr11468.ll
LLVM :: CodeGen/X86/unaligned-spill-folding.ll

I do not see this problem with a self-hosted release+asserts build, the problem seems to be triggered only when asserts are disabled.

ismail commented 10 years ago

I am using cmake. Build flags are:

cmake -G "Unix Makefiles" \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DLLVM_LIBDIR_SUFFIX=64 \ -DCLANG_RESOURCE_DIR=../%{_lib}/clang/%{_release_version} \ -DLLVM_REQUIRES_RTTI=ON \ -DLLVM_ENABLE_TIMESTAMPS=OFF \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_ENABLE_PIC=ON \ -DLLVM_BINUTILS_INCDIR=/usr/include \ -DLLVM_TARGETS_TO_BUILD=host

hfinkel commented 10 years ago

I just finished a stage2 (self-hosted) build with r195172 (which should be essentially identical to 3.4rc1), and all of the regression tests pass.

Are you using configure or cmake? What are your stage2 compile flags?

ismail commented 10 years ago

Well blaming the compiler is easy but,

  1. stage1 compiler is

gcc version 4.8.1 20130909 [gcc-4_8-branch revision 202388] (SUSE Linux)

and its built with -O0

  1. In stage2 we use clang thats built in stage1 so I believe compiler should be irrelevant here.
llvmbot commented 10 years ago

You may wish to compare your compiler with those on this page:

http://llvm.org/docs/GettingStarted.html#check-here

hfinkel commented 10 years ago

Thanks for reporting this!

What compiler and version was used to compile clang/llvm? What type of CPU is on the host system?

My one data point (gcc 4.4.7 on a REL 6.4 POWER7 system) does not exhibit this problem.