Skip to content

Inline assembly asserts when using wrong number of vector elements with physical register constraint #101190

Description

@arsenm

This test case uses an <8 x i32> width physical register constraint, but tries to use it as a <9 x i32> typed value. This should just be an error, but it results in an assertion in SelectionDAGBuilder.

; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s

define <9 x i32> @inline_asm_wrong_vector_type_assert_def() {
  %asm = call <9 x i32> asm sideeffect "; def $0", "={v[8:15]}"()
  ret <9 x i32> %asm
}

define void @inline_asm_wrong_vector_type_assert_use(<9 x i32> %val) {
  call void asm sideeffect "; use $0", "{v[8:15]}"(<9 x i32> %val)
  ret void
}

Hits this assertion:

Assertion failed: ((PartEVT.getVectorElementCount().getKnownMinValue() > ; ValueVT.getVectorElementCount().getKnownMinValue()) && (PartEVT.getVectorElementCount().isScalable() == ValueVT.getVectorElementCount().isScalable()) && "Cannot narrow, it would be a lossy transformation"), function getCopyFromPartsVector, file SelectionDAGBuilder.cpp, line 430.

Another similar failure happens if the result is a scalar:

define void @asm_assert_scalar_read_vector() {
  %asm = call i32 asm sideeffect "; def $0 ", "={s[4:5]}"()
  ret void
}

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions