This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][SelectionDAGBuilder] Fix crash when copying a v1f32 vector between basic blocks.
ClosedPublic

Authored by craig.topper on Sep 27 2022, 12:52 PM.

Details

Summary

On a rv64 without f32 or vector support, this will be passed across
the basic block as an i64. We need use i32 as an intermediate type
with bitcast and anyext/trunc.

Fixes PR58025

Diff Detail

Event Timeline

craig.topper created this revision.Sep 27 2022, 12:52 PM
craig.topper requested review of this revision.Sep 27 2022, 12:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2022, 12:53 PM
RKSimon added inline comments.Sep 27 2022, 1:03 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
455

Is implicit truncation guaranteed?

A description comment might be useful.

craig.topper added inline comments.Sep 27 2022, 1:33 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
455

I think so. The only case I know of this happening right now is PartEVT is i64 and ValueSVT is f32.

craig.topper edited the summary of this revision. (Show Details)Sep 27 2022, 2:13 PM
RKSimon accepted this revision.Sep 28 2022, 3:54 AM

LGTM (with the description comment about how this can happen)

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
455

Maybe use ValueSVT.changeTypeToInteger() ?

This revision is now accepted and ready to land.Sep 28 2022, 3:54 AM