llvm / llvm-project

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

CodeGen/RISCV/xtheadmempair.ll test failure on 32-bit arm #62195

Open thesamesam opened 1 year ago

thesamesam commented 1 year ago

The CodeGen/RISCV/xtheadmempair.ll test seems to fail on 32-bit Arm (tested at commit 0be1fbac2a7797399c0970e3f4033288036b65f6):

FAIL: LLVM :: CodeGen/RISCV/xtheadmempair.ll (16324 of 48813)
******************** TEST 'LLVM :: CodeGen/RISCV/xtheadmempair.ll' FAILED ********************
Script:
--
: 'RUN: at line 2';   /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/llc -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs < /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll    | /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV32XTHEADMEMPAIR
: 'RUN: at line 4';   /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/llc -mtriple=riscv64 -mattr=+xtheadmempair -verify-machineinstrs < /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll    | /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV64XTHEADMEMPAIR
--
Exit Code: 1

Command Output (stderr):
--
+ : 'RUN: at line 2'
+ /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/llc -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs
+ /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm_build-.arm/bin/FileCheck /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV32XTHEADMEMPAIR
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:10:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a1, a2, (a0), 2, 3
                          ^
<stdin>:10:9: note: scanning from here
# %bb.0:
        ^
<stdin>:11:2: note: possible intended match here
 lw a1, 16(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:37:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a1, a2, (a0), 2, 3
                          ^
<stdin>:29:9: note: scanning from here
# %bb.0:
        ^
<stdin>:30:2: note: possible intended match here
 lw a1, 16(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:86:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a1, a2, (a0), 0, 3
                          ^
<stdin>:63:9: note: scanning from here
# %bb.0:
        ^
<stdin>:64:2: note: possible intended match here
 lw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:113:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a1, a2, (a0), 0, 3
                          ^
<stdin>:82:9: note: scanning from here
# %bb.0:
        ^
<stdin>:83:2: note: possible intended match here
 lw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:136:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a1, a2, (a0), 0, 3
                          ^
<stdin>:97:9: note: scanning from here
# %bb.0:
        ^
<stdin>:98:2: note: possible intended match here
 lw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:160:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.swd a1, a2, (a0), 2, 3
                          ^
<stdin>:116:9: note: scanning from here
# %bb.0:
        ^
<stdin>:117:2: note: possible intended match here
 sw a1, 16(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:197:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.swd a1, a2, (a0), 0, 3
                          ^
<stdin>:144:9: note: scanning from here
# %bb.0:
        ^
<stdin>:145:2: note: possible intended match here
 sw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:214:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.swd a1, a2, (a0), 0, 3
                          ^
<stdin>:157:9: note: scanning from here
# %bb.0:
        ^
<stdin>:159:2: note: possible intended match here
 sw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:232:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a2, a1, (a0), 0, 3
                          ^
<stdin>:172:9: note: scanning from here
# %bb.0:
        ^
<stdin>:173:2: note: possible intended match here
 lw a2, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:248:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a2, a3, (a1), 1, 3
                          ^
<stdin>:186:9: note: scanning from here
# %bb.0:
        ^
<stdin>:187:2: note: possible intended match here
 lw a2, 12(a1)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:267:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.swd a1, a2, (a0), 0, 3
                          ^
<stdin>:205:9: note: scanning from here
# %bb.0:
        ^
<stdin>:207:2: note: possible intended match here
 sw a1, 0(a0)
 ^
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll:282:27: error: RV32XTHEADMEMPAIR-NEXT: expected string not found in input
; RV32XTHEADMEMPAIR-NEXT: th.lwd a2, a3, (a1), 1, 3
                          ^
<stdin>:218:9: note: scanning from here
# %bb.0:
        ^
<stdin>:219:2: note: possible intended match here
 lw a2, 12(a1)
 ^

Input file: <stdin>
Check file: /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230414/work/llvm/test/CodeGen/RISCV/xtheadmempair.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
            5:  .globl lwd # -- Begin function lwd 
            6:  .p2align 2 
            7:  .type lwd,@function 
            8: lwd: # @lwd 
            9:  .cfi_startproc 
           10: # %bb.0: 
next:10'0              X error: no match found
           11:  lw a1, 16(a0) 
next:10'0      ~~~~~~~~~~~~~~~
next:10'1       ?              possible intended match
           12:  lw a0, 20(a0) 
next:10'0      ~~~~~~~~~~~~~~~
           13:  srai a2, a1, 31 
next:10'0      ~~~~~~~~~~~~~~~~~
           14:  srai a3, a0, 31 
next:10'0      ~~~~~~~~~~~~~~~~~
           15:  add a0, a1, a0 
next:10'0      ~~~~~~~~~~~~~~~~
           16:  sltu a1, a0, a1 
next:10'0      ~~~~~~~~~~~~~~~~~
            .
            .
            .
           24:  .globl lwud # -- Begin function lwud 
next:10'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25:  .p2align 2 
next:10'0      ~~~~~~~~~~~~
           26:  .type lwud,@function 
next:10'0      ~~~~~~~~~~~~~~~~~~~~~~
           27: lwud: # @lwud 
next:10'0      ~~~~~
           28:  .cfi_startproc 
           29: # %bb.0: 
next:37'0              X error: no match found
           30:  lw a1, 16(a0) 
next:37'0      ~~~~~~~~~~~~~~~
next:37'1       ?              possible intended match
           31:  lw a0, 20(a0) 
next:37'0      ~~~~~~~~~~~~~~~
           32:  add a0, a1, a0 
next:37'0      ~~~~~~~~~~~~~~~~
           33:  sltu a1, a0, a1 
next:37'0      ~~~~~~~~~~~~~~~~~
           34:  ret 
next:37'0      ~~~~~
           35: .Lfunc_end1: 
next:37'0      ~~~~~~~~~~~~~
            .
            .
            .
           58:  .globl lwd_0 # -- Begin function lwd_0 
           59:  .p2align 2 
           60:  .type lwd_0,@function 
           61: lwd_0: # @lwd_0 
           62:  .cfi_startproc 
           63: # %bb.0: 
next:86'0              X error: no match found
           64:  lw a1, 0(a0) 
next:86'0      ~~~~~~~~~~~~~~
next:86'1       ?             possible intended match
           65:  lw a0, 4(a0) 
next:86'0      ~~~~~~~~~~~~~~
           66:  srai a2, a1, 31 
next:86'0      ~~~~~~~~~~~~~~~~~
           67:  srai a3, a0, 31 
next:86'0      ~~~~~~~~~~~~~~~~~
           68:  add a0, a1, a0 
next:86'0      ~~~~~~~~~~~~~~~~
           69:  sltu a1, a0, a1 
next:86'0      ~~~~~~~~~~~~~~~~~
            .
            .
            .
           77:  .globl lwud_0 # -- Begin function lwud_0 
next:86'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           78:  .p2align 2 
next:86'0      ~~~~~~~~~~~~
           79:  .type lwud_0,@function 
next:86'0      ~~~~~~~~~~~~~~~~~~~~~~~~
           80: lwud_0: # @lwud_0 
next:86'0      ~~~~~~~
           81:  .cfi_startproc 
           82: # %bb.0: 
next:113'0             X error: no match found
           83:  lw a1, 0(a0) 
next:113'0     ~~~~~~~~~~~~~~
next:113'1      ?             possible intended match
           84:  lw a0, 4(a0) 
next:113'0     ~~~~~~~~~~~~~~
           85:  add a0, a1, a0 
next:113'0     ~~~~~~~~~~~~~~~~
           86:  sltu a1, a0, a1 
next:113'0     ~~~~~~~~~~~~~~~~~
           87:  ret 
next:113'0     ~~~~~
           88: .Lfunc_end4: 
next:113'0     ~~~~~~~~~~~~~
            .
            .
            .
           92:  .globl ldd_0 # -- Begin function ldd_0 
next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           93:  .p2align 2 
next:113'0     ~~~~~~~~~~~~
           94:  .type ldd_0,@function 
next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~
           95: ldd_0: # @ldd_0 
next:113'0     ~~~~~~
           96:  .cfi_startproc 
           97: # %bb.0: 
next:136'0             X error: no match found
           98:  lw a1, 0(a0) 
next:136'0     ~~~~~~~~~~~~~~
next:136'1      ?             possible intended match
           99:  lw a2, 4(a0) 
next:136'0     ~~~~~~~~~~~~~~
          100:  lw a3, 12(a0) 
next:136'0     ~~~~~~~~~~~~~~~
          101:  lw a0, 8(a0) 
next:136'0     ~~~~~~~~~~~~~~
          102:  add a2, a2, a3 
next:136'0     ~~~~~~~~~~~~~~~~
          103:  add a0, a1, a0 
next:136'0     ~~~~~~~~~~~~~~~~
            .
            .
            .
          111:  .globl swd # -- Begin function swd 
next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          112:  .p2align 2 
next:136'0     ~~~~~~~~~~~~
          113:  .type swd,@function 
next:136'0     ~~~~~~~~~~~~~~~~~~~~~
          114: swd: # @swd 
next:136'0     ~~~~
          115:  .cfi_startproc 
          116: # %bb.0: 
next:160'0             X error: no match found
          117:  sw a1, 16(a0) 
next:160'0     ~~~~~~~~~~~~~~~
next:160'1      ?              possible intended match
          118:  sw a2, 20(a0) 
next:160'0     ~~~~~~~~~~~~~~~
          119:  ret 
next:160'0     ~~~~~
          120: .Lfunc_end6: 
next:160'0     ~~~~~~~~~~~~~
          121:  .size swd, .Lfunc_end6-swd 
next:160'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          122:  .cfi_endproc 
next:160'0     ~~~~~~~~~~~~~~
            .
            .
            .
          139:  .globl swd_0 # -- Begin function swd_0 
          140:  .p2align 2 
          141:  .type swd_0,@function 
          142: swd_0: # @swd_0 
          143:  .cfi_startproc 
          144: # %bb.0: 
next:197'0             X error: no match found
          145:  sw a1, 0(a0) 
next:197'0     ~~~~~~~~~~~~~~
next:197'1      ?             possible intended match
          146:  sw a2, 4(a0) 
next:197'0     ~~~~~~~~~~~~~~
          147:  ret 
next:197'0     ~~~~~
          148: .Lfunc_end8: 
next:197'0     ~~~~~~~~~~~~~
          149:  .size swd_0, .Lfunc_end8-swd_0 
next:197'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          150:  .cfi_endproc 
next:197'0     ~~~~~~~~~~~~~~
          151:  # -- End function 
next:197'0     ~~~~~~~~~~~~~~~~~~~
          152:  .globl sdd_0 # -- Begin function sdd_0 
next:197'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          153:  .p2align 2 
next:197'0     ~~~~~~~~~~~~
          154:  .type sdd_0,@function 
next:197'0     ~~~~~~~~~~~~~~~~~~~~~~~
          155: sdd_0: # @sdd_0 
next:197'0     ~~~~~~
          156:  .cfi_startproc 
          157: # %bb.0: 
next:214'0             X error: no match found
          158:  sw a2, 4(a0) 
next:214'0     ~~~~~~~~~~~~~~
          159:  sw a1, 0(a0) 
next:214'0     ~~~~~~~~~~~~~~
next:214'1      ?             possible intended match
          160:  sw a4, 12(a0) 
next:214'0     ~~~~~~~~~~~~~~~
          161:  sw a3, 8(a0) 
next:214'0     ~~~~~~~~~~~~~~
          162:  ret 
next:214'0     ~~~~~
          163: .Lfunc_end9: 
next:214'0     ~~~~~~~~~~~~~
          164:  .size sdd_0, .Lfunc_end9-sdd_0 
next:214'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          167:  .globl ld64 # -- Begin function ld64 
next:214'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          168:  .p2align 2 
next:214'0     ~~~~~~~~~~~~
          169:  .type ld64,@function 
next:214'0     ~~~~~~~~~~~~~~~~~~~~~~
          170: ld64: # @ld64 
next:214'0     ~~~~~
          171:  .cfi_startproc 
          172: # %bb.0: 
next:232'0             X error: no match found
          173:  lw a2, 0(a0) 
next:232'0     ~~~~~~~~~~~~~~
next:232'1      ?             possible intended match
          174:  lw a1, 4(a0) 
next:232'0     ~~~~~~~~~~~~~~
          175:  mv a0, a2 
next:232'0     ~~~~~~~~~~~
          176:  ret 
next:232'0     ~~~~~
          177: .Lfunc_end10: 
next:232'0     ~~~~~~~~~~~~~~
          178:  .size ld64, .Lfunc_end10-ld64 
next:232'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          181:  .globl ld128 # -- Begin function ld128 
next:232'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          182:  .p2align 2 
next:232'0     ~~~~~~~~~~~~
          183:  .type ld128,@function 
next:232'0     ~~~~~~~~~~~~~~~~~~~~~~~
          184: ld128: # @ld128 
next:232'0     ~~~~~~
          185:  .cfi_startproc 
          186: # %bb.0: 
next:248'0             X error: no match found
          187:  lw a2, 12(a1) 
next:248'0     ~~~~~~~~~~~~~~~
next:248'1      ?              possible intended match
          188:  lw a3, 8(a1) 
next:248'0     ~~~~~~~~~~~~~~
          189:  lw a4, 4(a1) 
next:248'0     ~~~~~~~~~~~~~~
          190:  lw a1, 0(a1) 
next:248'0     ~~~~~~~~~~~~~~
          191:  sw a2, 12(a0) 
next:248'0     ~~~~~~~~~~~~~~~
          192:  sw a3, 8(a0) 
next:248'0     ~~~~~~~~~~~~~~
            .
            .
            .
          200:  .globl sd64 # -- Begin function sd64 
next:248'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          201:  .p2align 2 
next:248'0     ~~~~~~~~~~~~
          202:  .type sd64,@function 
next:248'0     ~~~~~~~~~~~~~~~~~~~~~~
          203: sd64: # @sd64 
next:248'0     ~~~~~
          204:  .cfi_startproc 
          205: # %bb.0: 
next:267'0             X error: no match found
          206:  sw a2, 4(a0) 
next:267'0     ~~~~~~~~~~~~~~
          207:  sw a1, 0(a0) 
next:267'0     ~~~~~~~~~~~~~~
next:267'1      ?             possible intended match
          208:  ret 
next:267'0     ~~~~~
          209: .Lfunc_end12: 
next:267'0     ~~~~~~~~~~~~~~
          210:  .size sd64, .Lfunc_end12-sd64 
next:267'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          211:  .cfi_endproc 
next:267'0     ~~~~~~~~~~~~~~
          212:  # -- End function 
next:267'0     ~~~~~~~~~~~~~~~~~~~
          213:  .globl sd128 # -- Begin function sd128 
next:267'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          214:  .p2align 2 
next:267'0     ~~~~~~~~~~~~
          215:  .type sd128,@function 
next:267'0     ~~~~~~~~~~~~~~~~~~~~~~~
          216: sd128: # @sd128 
next:267'0     ~~~~~~
          217:  .cfi_startproc 
          218: # %bb.0: 
next:282'0             X error: no match found
          219:  lw a2, 12(a1) 
next:282'0     ~~~~~~~~~~~~~~~
next:282'1      ?              possible intended match
          220:  lw a3, 8(a1) 
next:282'0     ~~~~~~~~~~~~~~
          221:  lw a4, 4(a1) 
next:282'0     ~~~~~~~~~~~~~~
          222:  lw a1, 0(a1) 
next:282'0     ~~~~~~~~~~~~~~
          223:  sw a2, 12(a0) 
next:282'0     ~~~~~~~~~~~~~~~
          224:  sw a3, 8(a0) 
next:282'0     ~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>
# uname -a
Linux arm32-testing 5.15.64-gentoo-dist #1 SMP Wed Aug 31 17:57:10 -00 2022 armv8l ARMv8 Processor rev 1 (v8l) GNU/Linux

# emerge --info
Portage 3.0.46 (python 3.10.11-final-0, default/linux/arm/17.0/armv7a/desktop/plasma/systemd, gcc-12, glibc-2.37-r2, 5.15.64-gentoo-dist armv8l)
=================================================================
System uname: Linux-5.15.64-gentoo-dist-armv8l-ARMv8_Processor_rev_1_-v8l-with-glibc2.37
KiB Mem:   262955288 total,  54720988 free
KiB Swap:    9767620 total,   9557956 free
Timestamp of repository gentoo: Tue, 18 Apr 2023 04:31:57 +0000
sh bash 5.2_p15-r2
ld GNU ld (Gentoo 2.40 p4) 2.40.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r2::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.0-r2::gentoo
dev-lang/python:           3.10.11::gentoo, 3.11.3::gentoo
dev-lang/rust:             1.68.2::gentoo
dev-util/cmake:            3.26.3::gentoo
dev-util/meson:            1.0.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-apps/systemd:          253.3::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.32-r2::gentoo, 2.33.1-r1::gentoo, 2.34-r2::gentoo, 2.35.2::gentoo, 2.36.1-r2::gentoo, 2.37_p1-r2::gentoo, 2.38-r2::gentoo, 2.39-r5::gentoo, 2.40-r4::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.2.1_p20230304::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            16.0.1::gentoo
sys-devel/make:            4.4.1::gentoo
sys-kernel/linux-headers:  6.2::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="arm ~arm"
ACCEPT_LICENSE="@FREE"
CBUILD="armv7a-unknown-linux-gnueabihf"
CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
CHOST="armv7a-unknown-linux-gnueabihf"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going=y --complete-graph"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl activities alsa arm bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr encode exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kwallet lcms libglvnd libnotify mad mng mp3 mp4 mpeg ncurses nls nptl ogg opengl openmp pam pango pcre pdf plasma png policykit ppds qml qt5 readline sdl seccomp semantic-desktop sound spell split-usr ssl startup-notification svg systemd test-rust tiff truetype udev udisks unicode upower usb vorbis widgets wxwidgets x264 xattr xcb xft xml xv xvid zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 vfp" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby31 ruby32" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
thesamesam commented 1 year ago

cc @mgorny

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-risc-v

topperc commented 1 year ago

I don't have a 32-bit arm system to test this on. Can you try to debug it?

The relevant code starts in performMemPairCombine in RISCVISelLowering.cpp. If it hits any of the return SDValue(), that means it couldn't match the pattern. If you can figure out where it bailed out that would be great.

matoro commented 10 months ago

FYI, you can run and test 32-bit arm code in a chroot on a 64-bit arm system.

Tested on 17 rc4 and observed this plus one new failure. Full log:
dqdopi4.log

********************
Failed Tests (2):
  LLVM :: CodeGen/RISCV/attributes.ll
  LLVM :: CodeGen/RISCV/xtheadmempair.ll

Testing Time: 1103.99s
  Skipped          :    35
  Unsupported      :   982
  Passed           : 53864
  Expectedly Failed:   162
  Failed           :     2
ncopa commented 9 months ago

Same thing happens with llvm17.0.2 on alpine linux armv7 (with musl libc) and armhf (armv6).

ncopa commented 9 months ago

I don't have a 32-bit arm system to test this on. Can you try to debug it?

The relevant code starts in performMemPairCombine in RISCVISelLowering.cpp. If it hits any of the return SDValue(), that means it couldn't match the pattern. If you can figure out where it bailed out that would be great.

I can try help debug. How can I run that specific test in gdb, so I can set a breakpoint on SDValue?

ncopa commented 9 months ago

I git bisected the CodeGen/RISCV/attributes.ll test failure which landed on bbb58a2302c65b73943e00f2def3384a68177a7f. This is also the commit that introduces llvm/test/CodeGen/RISCV/xtheadmempair.ll.

topperc commented 9 months ago

I don't have a 32-bit arm system to test this on. Can you try to debug it?

The relevant code starts in performMemPairCombine in RISCVISelLowering.cpp. If it hits any of the return SDValue(), that means it couldn't match the pattern. If you can figure out where it bailed out that would be great.

I can try help debug. How can I run that specific test in gdb, so I can set a breakpoint on SDValue?

llvm-lit -v llvm/test/CodeGen/RISCV/xtheadmempair.ll hould print more information and you should be able to find the command line for llc.

ncopa commented 9 months ago
$ ./build/bin/llvm-lit -v ./llvm/test/CodeGen/RISCV/xtheadmempair.ll 
-- Testing: 1 tests, 1 workers --
FAIL: LLVM :: CodeGen/RISCV/xtheadmempair.ll (1 of 1)
******************** TEST 'LLVM :: CodeGen/RISCV/xtheadmempair.ll' FAILED ********************
Script:
--
: 'RUN: at line 2';   /home/ncopa/src/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs < /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll    | /home/ncopa/src/llvm-project/build/bin/FileCheck /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV32XTHEADMEMPAIR
: 'RUN: at line 4';   /home/ncopa/src/llvm-project/build/bin/llc -mtriple=riscv64 -mattr=+xtheadmempair -verify-machineinstrs < /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll    | /home/ncopa/src/llvm-project/build/bin/FileCheck /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV64XTHEADMEMPAIR
--
Exit Code: 2

Command Output (stderr):
--
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/ncopa/src/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Expand large div/rem' on function '@lwd'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/ncopa/src/llvm-project/build/bin/FileCheck /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll -check-prefix=RV32XTHEADMEMPAIR

--

********************
********************
Failed Tests (1):
  LLVM :: CodeGen/RISCV/xtheadmempair.ll

Testing Time: 0.04s
  Failed: 1

gdb backtrace:

$ gdb /home/ncopa/src/llvm-project/build/bin/llc #-mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7-alpine-linux-musleabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/ncopa/src/llvm-project/build/bin/llc...
(gdb) run -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs < /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll
Starting program: /home/ncopa/src/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+xtheadmempair -verify-machineinstrs < /home/ncopa/src/llvm-project/llvm/test/CodeGen/RISCV/xtheadmempair.ll
        .text
        .attribute      4, 16
        .attribute      5, "rv32i2p0_xtheadmempair1p0"
        .file   "<stdin>"

Program received signal SIGSEGV, Segmentation fault.
0x014377f8 in llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&) ()
(gdb) bt
#0  0x014377f8 in llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&) ()
#1  0x013c61ca in llvm::RISCVSubtarget::RISCVSubtarget(llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, unsigned int, unsigned int, llvm::TargetMachine const&) ()
#2  0x013c95f4 in llvm::RISCVTargetMachine::getSubtargetImpl(llvm::Function const&) const ()
#3  0x01d0857a in (anonymous namespace)::ExpandLargeDivRemLegacyPass::runOnFunction(llvm::Function&) ()
#4  0x0213fc3e in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
#5  0x0213fef8 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
#6  0x02140526 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#7  0x008f8034 in compileModule(char**, llvm::LLVMContext&) ()
#8  0x008644ca in main ()
ncopa commented 9 months ago

I originally tries to build it with debugging symbols but it got errors about emomry exhaused or similar (during linking?). I believe it runs out of addressable memory on 32 bit.

dtcxzyw commented 9 months ago

I originally tries to build it with debugging symbols but it got errors about emomry exhaused or similar (during linking?). I believe it runs out of addressable memory on 32 bit.

You can try with -DLLVM_PARALLEL_LINK_JOBS=1 or set up a swap space.

ncopa commented 9 months ago

I originally tries to build it with debugging symbols but it got errors about emomry exhaused or similar (during linking?). I believe it runs out of addressable memory on 32 bit.

You can try with -DLLVM_PARALLEL_LINK_JOBS=1 or set up a swap space.

I still get final link failed: memory exhausted. This is a 32 bit container on an aarch64 host with 256G ram, so I don't think adding swap will help. Problem is that there is not enough address space.

ncopa commented 9 months ago

How do I pass -g1 as the debug level?

ncopa commented 9 months ago

I was able to build it with debugging symbols by only building RISCV target. But then it would no longer segfault. (test still fails).

So I checked out current main (commit ) and built it again as "Release". The segfault came back. Here is disassembly:

(gdb) disas $pc-60,+120
Dump of assembler code from 0x7715a6 to 0x77161e:
   0x007715a6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5618>:       subs    r7, #44 @ 0x2c
   0x007715a8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5620>:       ldrb.w  r3, [r8, #3895] @ 0xf37
   0x007715ac <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5624>:       orr.w   r3, r3, #64     @ 0x40
   0x007715b0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5628>:       strb.w  r3, [r8, #3895] @ 0xf37
   0x007715b4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5632>:       ldrb.w  r3, [r0, #313]  @ 0x139
   0x007715b8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5636>:       cbz     r3, 0x7715f2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5694>
   0x007715ba <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5638>:       movs    r2, #1
   0x007715bc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5640>:       ldr     r3, [sp, #84]   @ 0x54
   0x007715be <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5642>:       ldr     r1, [sp, #88]   @ 0x58
   0x007715c0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5644>:       add.w   r5, r11, r3, asr #3
   0x007715c4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5648>:       add.w   r5, r5, #211968 @ 0x33c00
   0x007715c8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5652>:       ldrb.w  r6, [r5, #790]  @ 0x316
   0x007715cc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5656>:       and.w   r3, r3, #7
   0x007715d0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5660>:       lsl.w   r3, r2, r3
   0x007715d4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5664>:       add.w   r4, r11, r1, asr #3
   0x007715d8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5668>:       orrs    r3, r6
   0x007715da <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5670>:       add.w   r4, r4, #211968 @ 0x33c00
   0x007715de <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5674>:       strb.w  r3, [r5, #790]  @ 0x316
=> 0x007715e2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5678>:       ldrb.w  r3, [r4, #790]  @ 0x316
   0x007715e6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5682>:       and.w   r1, r1, #7
   0x007715ea <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5686>:       lsls    r2, r1
   0x007715ec <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5688>:       orrs    r3, r2
   0x007715ee <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5690>:       strb.w  r3, [r4, #790]  @ 0x316
   0x007715f2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5694>:       bl      0x6d7c54 <_ZNK4llvm14RISCVSubtarget27useRVVForFixedLengthVectorsEv>
   0x007715f6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5698>:       cbz     r0, 0x771604 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5712>
   0x007715f8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5700>:       ldrb.w  r3, [r8, #3889] @ 0xf31
   0x007715fc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5704>:       orr.w   r3, r3, #8
   0x00771600 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5708>:       strb.w  r3, [r8, #3889] @ 0xf31
   0x00771604 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5712>:       movs    r0, #1
   0x00771606 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5714>:       ldr.w   r2, [pc, #1276] @ 0x771b04 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6992>
   0x0077160a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5718>:       ldr.w   r3, [pc, #1276] @ 0x771b08 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6996>
   0x0077160e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5722>:       add     r2, pc
   0x00771610 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5724>:       add     r3, pc
   0x00771612 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5726>:       add.w   r1, r11, #212992        @ 0x34000
   0x00771616 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5730>:       strd    r2, r3, [r1, #948]      @ 0x3b4
   0x0077161a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5734>:       ldr     r3, [sp, #12]
   0x0077161c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5736>:       ldr.w   r2, [pc, #1260] @ 0x771b0c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+7000>
End of assembler dump.
(gdb) bt
#0  0x007715e2 in llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&) ()
#1  0x006d851a in llvm::RISCVSubtarget::RISCVSubtarget(llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, unsigned int, unsigned int, llvm::TargetMachine const&) ()
#2  0x006dc4e8 in llvm::RISCVTargetMachine::getSubtargetImpl(llvm::Function const&) const ()
#3  0x00a2d6f8 in (anonymous namespace)::ExpandLargeDivRemLegacyPass::runOnFunction(llvm::Function&) ()
#4  0x00ee2996 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
#5  0x00ee2c0c in llvm::FPPassManager::runOnModule(llvm::Module&) ()
#6  0x00ee323e in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#7  0x006a894e in compileModule(char**, llvm::LLVMContext&) ()
#8  0x00657fbe in main ()
topperc commented 9 months ago

Are you able to get a line number in llvm::RISCVTargetLowering::RISCVTargetLowering? That's a big function.

topperc commented 9 months ago

Reading the disassembly carefully and comparing to the source, I think its the XTHeadMemPair part of this code

  if (Subtarget.hasVInstructions())                                              
    setTargetDAGCombine({ISD::FCOPYSIGN, ISD::MGATHER, ISD::MSCATTER,            
                         ISD::VP_GATHER, ISD::VP_SCATTER, ISD::SRA, ISD::SRL,    
                         ISD::SHL, ISD::STORE, ISD::SPLAT_VECTOR,                
                         ISD::BUILD_VECTOR, ISD::CONCAT_VECTORS});               
  if (Subtarget.hasVendorXTHeadMemPair())                                        
    setTargetDAGCombine({ISD::LOAD, ISD::STORE});                                
  if (Subtarget.useRVVForFixedLengthVectors())                                   
    setTargetDAGCombine(ISD::BITCAST);    
topperc commented 9 months ago

@ncopa can you dump the registers?

ncopa commented 9 months ago

looks like it is r4+790 that causes the segfault. and it is not mapped to anything.

(gdb) info reg
r0             0xf7c405b0          4156818864
r1             0x1fcfeb8           33357496
r2             0x1                 1
r3             0x1                 1
r4             0xf806e41f          4161201183
r5             0xf7c74448          4157031496
r6             0x0                 0
r7             0x1726              5926
r8             0xf7c73848          4157028424
r9             0xf7c405b0          4156818864
r10            0x0                 0
r11            0xf7c40848          4156819528
r12            0x4                 4
sp             0xfffeed80          0xfffeed80
lr             0x77146f            7804015
pc             0x7715e2            0x7715e2 <llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&)+5678>
cpsr           0x30                48
fpscr          0x0                 0
tpidruro       <unavailable>
(gdb) p $r4 + 790
$1 = 4161201973
(gdb) x/4bx $r4+790
0xf806e735:     Cannot access memory at address 0xf806e735
(gdb) info proc map
process 10128
Mapped address spaces:

        Start Addr   End Addr       Size     Offset  Perms   objfile
          0x400000  0x215a000  0x1d5a000        0x0  r-xp   /home/ncopa/src/llvm-project/build-release/bin/llc
         0x215a000  0x218f000    0x35000  0x1d5a000  r--p   /home/ncopa/src/llvm-project/build-release/bin/llc
         0x218f000  0x2192000     0x3000  0x1d8f000  rw-p   /home/ncopa/src/llvm-project/build-release/bin/llc
         0x2192000  0x21ba000    0x28000        0x0  rw-p   [heap]
         0x21ba000  0x21bb000     0x1000        0x0  ---p   [heap]
         0x21bb000  0x21bd000     0x2000        0x0  rw-p   [heap]
        0xf7c40000 0xf7cf9000    0xb9000        0x0  rw-p   
        0xf7cf9000 0xf7d01000     0x8000        0x0  r-xp   /usr/lib/libgcc_s.so.1
        0xf7d01000 0xf7d02000     0x1000     0x7000  r--p   /usr/lib/libgcc_s.so.1
        0xf7d02000 0xf7d03000     0x1000     0x8000  rw-p   /usr/lib/libgcc_s.so.1
        0xf7d03000 0xf7eda000   0x1d7000        0x0  r-xp   /usr/lib/libstdc++.so.6.0.32
        0xf7eda000 0xf7ee1000     0x7000   0x1d7000  r--p   /usr/lib/libstdc++.so.6.0.32
        0xf7ee1000 0xf7ee2000     0x1000   0x1de000  rw-p   /usr/lib/libstdc++.so.6.0.32
        0xf7ee2000 0xf7ee4000     0x2000        0x0  rw-p   
        0xf7ee4000 0xf7f58000    0x74000        0x0  r-xp   /usr/lib/libzstd.so.1.5.5
        0xf7f58000 0xf7f59000     0x1000    0x73000  r--p   /usr/lib/libzstd.so.1.5.5
        0xf7f59000 0xf7f5a000     0x1000    0x74000  rw-p   /usr/lib/libzstd.so.1.5.5
        0xf7f5a000 0xf7f69000     0xf000        0x0  r-xp   /lib/libz.so.1.3
        0xf7f69000 0xf7f6a000     0x1000     0xe000  r--p   /lib/libz.so.1.3
        0xf7f6a000 0xf7f6b000     0x1000     0xf000  rw-p   /lib/libz.so.1.3
        0xf7f6b000 0xf7f6c000     0x1000        0x0  r-xp   [sigpage]
        0xf7f6c000 0xf7fed000    0x81000        0x0  r-xp   /lib/ld-musl-armhf.so.1
        0xf7fed000 0xf7fef000     0x2000    0x80000  rw-p   /lib/ld-musl-armhf.so.1
        0xf7fef000 0xf7ff0000     0x1000        0x0  rw-p   
        0xfffcf000 0xffff0000    0x21000        0x0  rw-p   [stack]
        0xffff0000 0xffff1000     0x1000        0x0  r-xp   [vectors]
ncopa commented 9 months ago

Reading the disassembly carefully and comparing to the source, I think its the XTHeadMemPair part of this code

  if (Subtarget.hasVInstructions())                                              
    setTargetDAGCombine({ISD::FCOPYSIGN, ISD::MGATHER, ISD::MSCATTER,            
                         ISD::VP_GATHER, ISD::VP_SCATTER, ISD::SRA, ISD::SRL,    
                         ISD::SHL, ISD::STORE, ISD::SPLAT_VECTOR,                
                         ISD::BUILD_VECTOR, ISD::CONCAT_VECTORS});               
  if (Subtarget.hasVendorXTHeadMemPair())                                        
    setTargetDAGCombine({ISD::LOAD, ISD::STORE});                                
  if (Subtarget.useRVVForFixedLengthVectors())                                   
    setTargetDAGCombine(ISD::BITCAST);    

That corresponds with the change introducing the issue. https://github.com/llvm/llvm-project/commit/bbb58a2302c65b73943e00f2def3384a68177a7f#diff-b836770407029aa900efa9e60c57f4d71add22b49ebe56c4b1a1effe403c8af8R1067

topperc commented 9 months ago

The value in r1 looks way off. I think it should be the opcode for ISD::STORE.

I think this code is supposed be reading the 2 values out of the {ISD::LOAD, ISD::STORE} initializer_list.

   0x007715bc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5640>:       ldr     r3, [sp, #84]   @ 0x54
   0x007715be <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5642>:       ldr     r1, [sp, #88]   @ 0x58

The value in r3 has been overwritten by the time the crash happens. But r1 hasn't.

awilfox commented 9 months ago

No longer segfaulting when built debug + only RISC-V target makes me think one of two things:

topperc commented 9 months ago

Does changing the code to

  if (Subtarget.hasVendorXTHeadMemPair())   {
    setTargetDAGCombine(ISD::LOAD);
    setTargetDAGCombine(ISD::STORE); 
}

fix the sissue

ncopa commented 9 months ago

Does changing the code to

  if (Subtarget.hasVendorXTHeadMemPair())   {
    setTargetDAGCombine(ISD::LOAD);
    setTargetDAGCombine(ISD::STORE); 
}

fix the sissue

-- Testing: 1 tests, 1 workers --
PASS: LLVM :: CodeGen/RISCV/xtheadmempair.ll (1 of 1)

Testing Time: 0.09s
  Passed: 1
...
-- Testing: 1 tests, 1 workers --
PASS: LLVM :: CodeGen/RISCV/attributes.ll (1 of 1)

Testing Time: 1.65s
  Passed: 1

Yes it does indeed!

ncopa commented 9 months ago

Maybe try building with debug and two or three targets (smaller ones like Sparc and M68K maybe? Probably not X86…)

I did this, and the test fails, even if it does not segfault. So I added a breakpoint and stepped through it.

(gdb) n                                                                                                                                                                                        
1320        setTargetDAGCombine({ISD::LOAD, ISD::STORE});                                                                                                                                      
(gdb) list                                                                                                                                                                                     
1315        setTargetDAGCombine({ISD::FCOPYSIGN, ISD::MGATHER, ISD::MSCATTER,                                                                                                                  
1316                             ISD::VP_GATHER, ISD::VP_SCATTER, ISD::SRA, ISD::SRL,                                                                                                          
1317                             ISD::SHL, ISD::STORE, ISD::SPLAT_VECTOR,                                                                                                                      
1318                             ISD::BUILD_VECTOR, ISD::CONCAT_VECTORS});                                                                                                                     
1319      if (Subtarget.hasVendorXTHeadMemPair())                                                                                                                                              
1320        setTargetDAGCombine({ISD::LOAD, ISD::STORE});                                                                                                                                      
1321      if (Subtarget.useRVVForFixedLengthVectors())                                                                                                                                         
1322        setTargetDAGCombine(ISD::BITCAST);                                                                                                                                                 
1323                                                                                                                                                                                           
1324      setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfsf2");                                                                                                                               
(gdb) info reg                                                                                                                                                                                 
r0             0xc4                196                                                                                                                                                         
r1             0x10                16                                                                                                                                                          r2             0xf7c744a0          4157031584
r3             0x1                 1                                                                                                                                                           
r4             0xfffeeea4          4294897316                                                                                                                                                  
r5             0xf7c405f0          4156818928                                                                                                                                                  
r6             0x1                 1
r7             0x1c75db8           29842872
r8             0x0                 0
r9             0x0                 0
r10            0xf7c40888          4156819592
r11            0xfffeee7c          4294897276
r12            0xfffeee9c          4294897308
sp             0xfffeede8          0xfffeede8
lr             0x766c3b            7760955
pc             0x76748e            0x76748e <llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&)+5498>
cpsr           0x20000030          536870960
fpscr          0x0                 0
tpidruro       <unavailable>
(gdb) disas $pc-40,+80
Dump of assembler code from 0x767466 to 0x7674b6:
   0x00767466 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5458>:       b.w     0x767e06 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubt
argetE+7922>
   0x0076746a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5462>:       add.w   r2, r10, #208896        @ 0x33000
   0x0076746e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5466>:       ldrb.w  r3, [r2, #3885] @ 0xf2d
   0x00767472 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5470>:       orr.w   r3, r3, #32
   0x00767476 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5474>:       strb.w  r3, [r2, #3885] @ 0xf2d
   0x0076747a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5478>:       b.n     0x766cfc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubt
argetE+3560>
   0x0076747c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5480>:       add.w   r2, r10, #208896        @ 0x33000
   0x00767480 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5484>:       ldrb.w  r3, [r2, #3889] @ 0xf31
   0x00767484 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5488>:       orr.w   r3, r3, #8
   0x00767488 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5492>:       strb.w  r3, [r2, #3889] @ 0xf31
   0x0076748c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5496>:       b.n     0x766d86 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubt
argetE+3698>
=> 0x0076748e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5498>:       movs    r2, #1
   0x00767490 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5500>:       ldr     r3, [sp, #148]  @ 0x94
   0x00767492 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5502>:       ldr     r4, [sp, #152]  @ 0x98
   0x00767494 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5504>:       add.w   r0, r10, r3, asr #3
   0x00767498 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5508>:       add.w   r0, r0, #211968 @ 0x33c00
   0x0076749c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5512>:       ldrb.w  r6, [r0, #790]  @ 0x316
   0x007674a0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5516>:       and.w   r3, r3, #7
   0x007674a4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5520>:       lsl.w   r3, r2, r3
   0x007674a8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5524>:       add.w   r1, r10, r4, asr #3
   0x007674ac <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5528>:       orrs    r3, r6
   0x007674ae <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5530>:       add.w   r1, r1, #211968 @ 0x33c00
   0x007674b2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5534>:       strb.w  r3, [r0, #790]  @ 0x316
End of assembler dump.
(gdb) step
0x0076748e in llvm::TargetLoweringBase::setTargetDAGCombine (NTs=..., this=<optimized out>) at /home/ncopa/src/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h:2616
2616          TargetDAGCombineArray[NT >> 3] |= 1 << (NT & 7);
(gdb) info reg
r0             0xc4                196
r1             0x10                16
r2             0xf7c744a0          4157031584
r3             0x1                 1
r4             0xfffeeea4          4294897316
r5             0xf7c405f0          4156818928
r6             0x1                 1
r7             0x1c75db8           29842872
r8             0x0                 0
r9             0x0                 0
r10            0xf7c40888          4156819592
r11            0xfffeee7c          4294897276
r12            0xfffeee9c          4294897308
sp             0xfffeede8          0xfffeede8
lr             0x766c3b            7760955
pc             0x76748e            0x76748e <llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&)+5498>
cpsr           0x20000030          536870960
fpscr          0x0                 0
tpidruro       <unavailable>
(gdb) disas $pc-20,+80
Dump of assembler code from 0x76747a to 0x7674ca:
   0x0076747a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5478>:       b.n     0x766cfc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3560>
   0x0076747c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5480>:       add.w   r2, r10, #208896        @ 0x33000
   0x00767480 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5484>:       ldrb.w  r3, [r2, #3889] @ 0xf31
   0x00767484 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5488>:       orr.w   r3, r3, #8
   0x00767488 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5492>:       strb.w  r3, [r2, #3889] @ 0xf31
   0x0076748c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5496>:       b.n     0x766d86 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3698>
=> 0x0076748e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5498>:       movs    r2, #1
   0x00767490 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5500>:       ldr     r3, [sp, #148]  @ 0x94
   0x00767492 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5502>:       ldr     r4, [sp, #152]  @ 0x98
   0x00767494 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5504>:       add.w   r0, r10, r3, asr #3
   0x00767498 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5508>:       add.w   r0, r0, #211968 @ 0x33c00
   0x0076749c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5512>:       ldrb.w  r6, [r0, #790]  @ 0x316
   0x007674a0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5516>:       and.w   r3, r3, #7
   0x007674a4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5520>:       lsl.w   r3, r2, r3
   0x007674a8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5524>:       add.w   r1, r10, r4, asr #3
   0x007674ac <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5528>:       orrs    r3, r6
   0x007674ae <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5530>:       add.w   r1, r1, #211968 @ 0x33c00
   0x007674b2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5534>:       strb.w  r3, [r0, #790]  @ 0x316
   0x007674b6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5538>:       ldrb.w  r3, [r1, #790]  @ 0x316
   0x007674ba <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5542>:       and.w   r4, r4, #7
   0x007674be <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5546>:       lsls    r2, r4
   0x007674c0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5548>:       orrs    r3, r2
   0x007674c2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5550>:       strb.w  r3, [r1, #790]  @ 0x316
   0x007674c6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5554>:       b.n     0x766d7a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3686>
   0x007674c8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5556>:       mov     r7, r11
End of assembler dump.
(gdb) step
llvm::RISCVTargetLowering::RISCVTargetLowering (this=this@entry=0xf7c40888, TM=<error reading variable: Could not find type for operation>, 
    STI=<error reading variable: Could not find type for operation>) at /home/ncopa/src/llvm-project/llvm/include/llvm/CodeGen/TargetLowering.h:2614
2614        for (auto NT : NTs) {
(gdb) list
2609
2610      /// Targets should invoke this method for each target independent node that
2611      /// they want to provide a custom DAG combiner for by implementing the
2612      /// PerformDAGCombine virtual method.
2613      void setTargetDAGCombine(ArrayRef<ISD::NodeType> NTs) {
2614        for (auto NT : NTs) {
2615          assert(unsigned(NT >> 3) < std::size(TargetDAGCombineArray));
2616          TargetDAGCombineArray[NT >> 3] |= 1 << (NT & 7);
2617        }
2618      }
(gdb) info reg
r0             0xf7c7448d          4157031565
r1             0xf7c7448d          4157031565
r2             0x40                64
r3             0xe0                224
r4             0x6                 6
r5             0xf7c405f0          4156818928
r6             0xe0                224
r7             0x1c75db8           29842872
r8             0x0                 0
r9             0x0                 0
r10            0xf7c40888          4156819592
r11            0xfffeee7c          4294897276
r12            0xfffeee9c          4294897308
sp             0xfffeede8          0xfffeede8
lr             0x766c3b            7760955
pc             0x7674c6            0x7674c6 <llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&)+5554>
cpsr           0x30                48
fpscr          0x0                 0
tpidruro       <unavailable>
(gdb) disas $pc-20,+80
Dump of assembler code from 0x7674b2 to 0x767502:
   0x007674b2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5534>:       strb.w  r3, [r0, #790]  @ 0x316
   0x007674b6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5538>:       ldrb.w  r3, [r1, #790]  @ 0x316
   0x007674ba <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5542>:       and.w   r4, r4, #7
   0x007674be <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5546>:       lsls    r2, r4
   0x007674c0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5548>:       orrs    r3, r2
   0x007674c2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5550>:       strb.w  r3, [r1, #790]  @ 0x316
=> 0x007674c6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5554>:       b.n     0x766d7a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3686>
   0x007674c8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5556>:       mov     r7, r11
   0x007674ca <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5558>:       mov     r12, r11
   0x007674cc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5560>:       mov.w   lr, #1
   0x007674d0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5564>:       ldr     r4, [pc, #960]  @ (0x767894 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6528>)
   0x007674d2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5566>:       add     r6, sp, #196    @ 0xc4
   0x007674d4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5568>:       add     r4, pc
   0x007674d6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5570>:       add.w   r4, r4, #1080   @ 0x438
   0x007674da <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5574>:       ldmia   r4!, {r0, r1, r2, r3}
   0x007674dc <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5576>:       stmia   r7!, {r0, r1, r2, r3}
   0x007674de <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5578>:       ldmia   r4!, {r0, r1, r2, r3}
   0x007674e0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5580>:       stmia   r7!, {r0, r1, r2, r3}
   0x007674e2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5582>:       ldmia.w r4, {r0, r1, r2, r3}
   0x007674e6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5586>:       stmia.w r7, {r0, r1, r2, r3}
   0x007674ea <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5590>:       ldr.w   r3, [r12], #4
   0x007674ee <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5594>:       add.w   r2, r10, r3, asr #3
   0x007674f2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5598>:       add.w   r2, r2, #211968 @ 0x33c00
   0x007674f6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5602>:       ldrb.w  r1, [r2, #790]  @ 0x316
   0x007674fa <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5606>:       and.w   r3, r3, #7
   0x007674fe <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5610>:       lsl.w   r3, lr, r3
End of assembler dump.
(gdb) step
1321      if (Subtarget.useRVVForFixedLengthVectors())
(gdb) info reg
r0             0xf7c7448d          4157031565
r1             0xf7c7448d          4157031565
r2             0x40                64
r3             0xe0                224
r4             0x6                 6
r5             0xf7c405f0          4156818928
r6             0xe0                224
r7             0x1c75db8           29842872
r8             0x0                 0
r9             0x0                 0
r10            0xf7c40888          4156819592
r11            0xfffeee7c          4294897276
r12            0xfffeee9c          4294897308
sp             0xfffeede8          0xfffeede8
lr             0x766c3b            7760955
pc             0x766d7a            0x766d7a <llvm::RISCVTargetLowering::RISCVTargetLowering(llvm::TargetMachine const&, llvm::RISCVSubtarget const&)+3686>
cpsr           0x30                48
fpscr          0x0                 0
tpidruro       <unavailable>
(gdb) disas $pc-20,+80
Dump of assembler code from 0x766d66 to 0x766db6:
   0x00766d66 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3666>:       ldrb.w  r3, [r5, #276]  @ 0x114
   0x00766d6a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3670>:       cmp     r3, #0
   0x00766d6c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3672>:       bne.w   0x7674c8 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5556>
   0x00766d70 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3676>:       ldrb.w  r3, [r5, #313]  @ 0x139
   0x00766d74 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3680>:       cmp     r3, #0
   0x00766d76 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3682>:       bne.w   0x76748e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5498>
=> 0x00766d7a <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3686>:       mov     r0, r5
   0x00766d7c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3688>:       bl      0x6e7bc4 <_ZNK4llvm14RISCVSubtarget27useRVVForFixedLengthVectorsEv>
   0x00766d80 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3692>:       cmp     r0, #0
   0x00766d82 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3694>:       bne.w   0x76747c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+5480>
   0x00766d86 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3698>:       movs    r0, #1
   0x00766d88 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3700>:       ldr.w   r2, [pc, #2728] @ 0x767834 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6432>
   0x00766d8c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3704>:       ldr.w   r3, [pc, #2728] @ 0x767838 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6436>
   0x00766d90 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3708>:       add     r2, pc
   0x00766d92 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3710>:       add     r3, pc
   0x00766d94 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3712>:       add.w   r1, r10, #212992        @ 0x34000
   0x00766d98 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3716>:       strd    r2, r3, [r1, #948]      @ 0x3b4
   0x00766d9c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3720>:       ldr     r3, [sp, #12]
   0x00766d9e <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3722>:       ldr.w   r2, [pc, #2716] @ 0x76783c <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6440>
   0x00766da2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3726>:       strb.w  r0, [r3, #3610] @ 0xe1a
   0x00766da6 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3730>:       ldr.w   r3, [pc, #2712] @ 0x767840 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+6444>
   0x00766daa <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3734>:       add     r2, pc
   0x00766dac <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3736>:       ldr     r3, [r2, r3]
   0x00766dae <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3738>:       ldr     r2, [r3, #0]
   0x00766db0 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3740>:       ldr     r3, [sp, #204]  @ 0xcc
   0x00766db2 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3742>:       eors    r2, r3
   0x00766db4 <_ZN4llvm19RISCVTargetLoweringC2ERKNS_13TargetMachineERKNS_14RISCVSubtargetE+3744>:       mov.w   r3, #0
End of assembler dump.

I hope that helps.

ncopa commented 9 months ago

I also tried to build with gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219 , gcc (Alpine 13.1.1_git20230722) 13.1.1 20230722 and Alpine clang version 16.0.6. It did not make any difference.

ncopa commented 4 months ago

Just changing the order also makes the test pass.

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 08678a859ae2..670f1422e758 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1424,7 +1424,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
                          ISD::EXPERIMENTAL_VP_REVERSE, ISD::MUL,
                          ISD::INSERT_VECTOR_ELT, ISD::ABS});
   if (Subtarget.hasVendorXTHeadMemPair())
-    setTargetDAGCombine({ISD::LOAD, ISD::STORE});
+    setTargetDAGCombine({ISD::STORE, ISD::LOAD});
+
   if (Subtarget.useRVVForFixedLengthVectors())
     setTargetDAGCombine(ISD::BITCAST);
matoro commented 2 months ago

This also fails on 64-bit mips, so it's not inherently a 32-bit issue.