llvm / llvm-project

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

CellSPU assert 'false && "Invalid value type!"' #3408

Closed llvmbot closed 6 years ago

llvmbot commented 16 years ago
Bugzilla Link 3036
Resolution FIXED
Resolved on Nov 07, 2018 00:22
Version trunk
OS Windows XP
Reporter LLVM Bugzilla Contributor

Extended Description

Given the following C-language, test_float4.c, which is compiled with clang

typedef float float4 attribute((ext_vector_type(4)));

int check(float4 a) { return a.x == 0.0f; }

Or given the following IR (after optimization)

; ModuleID = 'test-float4' target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128" target triple = "ppc-unknown-linux-gnu"

define i32 @​check(<4 x float> %a) nounwind readnone { entry: %0 = extractelement <4 x float> %a, i32 0 ; [#uses=1] %1 = fcmp oeq float %0, 0.000000e+00 ; [#uses=1] %2 = zext i1 %1 to i32 ; [#uses=1] ret i32 %2 }

The CellSPU backend generates an assert failure (llc -march=cellspu test-float4)

llc: SPUISelLowering.cpp:2070: llvm::SDValue LowerEXTRACT_VECTOR_ELT(llvm::SDValue, llvm::SelectionDAG&): Assertion `false && "Invalid value type!"' failed.

I brief review of the code and it appears that the LowerEXTRACT_VECTOR_ELT function needs cases added for MVT::f32 and MVT::f64

llvmbot commented 16 years ago

Verified that the problem is now fixed. Thanks!

llvmbot commented 16 years ago

Fixed. Uncovered additional argument handling bug in LowerFORMAL_ARGUMENTS as well, which was also fixed.

Given the following C-language, test_float4.c, which is compiled with clang

typedef float float4 attribute((ext_vector_type(4)));

int check(float4 a) { return a.x == 0.0f; }

Or given the following IR (after optimization)

; ModuleID = 'test-float4' target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128" target triple = "ppc-unknown-linux-gnu"

define i32 @​check(<4 x float> %a) nounwind readnone { entry: %0 = extractelement <4 x float> %a, i32 0 ; [#uses=1] %1 = fcmp oeq float %0, 0.000000e+00 ; [#uses=1] %2 = zext i1 %1 to i32 ; [#uses=1] ret i32 %2 }

The CellSPU backend generates an assert failure (llc -march=cellspu test-float4)

llc: SPUISelLowering.cpp:2070: llvm::SDValue LowerEXTRACT_VECTOR_ELT(llvm::SDValue, llvm::SelectionDAG&): Assertion `false && "Invalid value type!"' failed.

I brief review of the code and it appears that the LowerEXTRACT_VECTOR_ELT function needs cases added for MVT::f32 and MVT::f64