This is an archive of the discontinued LLVM Phabricator instance.

Fix crash in X86 ISelLowering: ConstantDataSequential can contain float as well
AbandonedPublic

Authored by mehdi_amini on May 29 2023, 6:04 PM.

Details

Reviewers
RKSimon
Summary

Fixes #62995

Here is a minimal repro:

// RUN: llc %s -mtriple=x86_64-unknown-linux-gnu   -mcpu="znver4"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare void @printF32(float)

define void @entry() {
  %L1 = insertelement <4 x float> poison, float 0.000000e+00, i64 1
  %L4 = fadd <4 x float> %L1, zeroinitializer
  %L5 = insertvalue [3 x <4 x float>] undef, <4 x float> %L4, 0
  %L8 = extractvalue [3 x <4 x float>] %L5, 0
  %L9 = extractelement <4 x float> %L8, i64 0
  call void @printF32(float %L9)
  %L10 = extractelement <4 x float> %L8, i64 1
  call void @printF32(float %L10)
  ret void
}

Diff Detail

Event Timeline

mehdi_amini created this revision.May 29 2023, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2023, 6:04 PM
mehdi_amini requested review of this revision.May 29 2023, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2023, 6:04 PM

This is fixing a crash (found in MLIR integration tests), let me know if you have a suggestion on how to test this?

Sorry @mehdi_amini I didn't see this - I've pushed my own fix here: rG95661b9c7545b56e6ec5a0cfec75587f37a7ca50

mehdi_amini added a comment.EditedMay 30 2023, 9:48 AM

Thanks for the fix!

I have one more assertions in codegen from one of the MLIR JIT tests, interested?
It looks like this:

SoftPromoteHalfOperand Op #1: t11: v32bf16 = insert_vector_elt t9, t7, Constant:i64<1>

Do not know how to soft promote this operator's operand!
UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2940!
mehdi_amini abandoned this revision.May 30 2023, 9:48 AM

Thanks for the fix!

I have one more assertions in codegen from one of the MLIR JIT tests, interested?
It looks like this:

SoftPromoteHalfOperand Op #1: t11: v32bf16 = insert_vector_elt t9, t7, Constant:i64<1>

Do not know how to soft promote this operator's operand!
UNREACHABLE executed at llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2940!

Sure - please can you raise a bug?

mehdi_amini added a comment.EditedMay 30 2023, 10:55 AM

Here is the bug: https://github.com/llvm/llvm-project/issues/63017
I extracted the IR from the JIT test so you don't have to build MLIR (and bugpointed it to a oneliner) :)