Skip to content

1.52.1 LLVM 12 on 32-bit mips has intrinsics problems #85562

@infinity0

Description

@infinity0

LLVM intrinsics text output seems to be getting corrupted on mipsel 32-bit with LLVM 12 - but it is fine on LLVM 11.

We have run the build twice to try to rule out possible hardware issues - build 1, build 2

The issue causes LLVM intrinsics-related FileCheck tests to fail, with error messages like:

/<<PKGBUILDDIR>>/src/test/codegen/call-llvm-intrinsics.rs:26:12: error: CHECK: expected string not found in input
 // CHECK: call float @llvm.sqrt.f32(float 4.000000e+00
           ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/call-llvm-intrinsics/call-llvm-intrinsics.ll:1:1: note: scanning from here
; ModuleID = 'call_llvm_intrinsics.3a1fbbbh-cgu.0'
^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/call-llvm-intrinsics/call-llvm-intrinsics.ll:21:2: note: possible intended match here
 call void @llvm.lifetime.start.00G8(i64 8, i8* %1)
 ^
/<<PKGBUILDDIR>>/src/test/codegen/consts.rs:46:12: error: CHECK: expected string not found in input
 // CHECK: memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 2 %1, i8* align 2 getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0), i{{(32|64)}} 8, i1 false)
           ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/consts/consts.ll:37:28: note: scanning from here
define i64 @low_align_const() unnamed_addr #0 {
                           ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/consts/consts.ll:37:28: note: with "LOW_HIGH" equal to "@alloc16"
define i64 @low_align_const() unnamed_addr #0 {
                           ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/consts/consts.ll:41:18: note: possible intended match here
 call void @llvm.memcpy.00G8.00G8.G32(i8* align 2 %1, i8* align 2 getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* @alloc16, i32 0, i32 0, i32 0), i32 8, i1 false)
                 ^
/<<PKGBUILDDIR>>/src/test/codegen/consts.rs:54:12: error: CHECK: expected string not found in input
 // CHECK: memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 4 %1, i8* align 4 getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* [[LOW_HIGH]], i32 0, i32 0, i32 0), i{{(32|64)}} 8, i1 false)
           ^
/<<PKGBUILDDIR>>/src/test/codegen/intrinsics/nearby.rs:9:12: error: CHECK: expected string not found in input
 // CHECK: llvm.nearbyint.f32
           ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/intrinsics/nearby/nearby.ll:7:27: note: scanning from here
define float @nearbyintf32(float %a) unnamed_addr #0 {
                          ^
/<<PKGBUILDDIR>>/build/mipsel-unknown-linux-gnu/test/codegen/intrinsics/nearby/nearby.ll:9:24: note: possible intended match here
 %0 = tail call float @llvm.nearbyint.toH(float %a)
                       ^

Note that the output contains function mangled type strings like ".00G8" and ".toH" which are not legitimate values for a mangled type string (see https://github.com/llvm/llvm-project/blob/5b6cae5524905bc43cfc21a515f828528d1f2e68/llvm/lib/IR/Function.cpp#L777), pointing to a memory corruption bug either in LLVM 12 or rustc.

Investigation is ongoing, will update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions