This is an archive of the discontinued LLVM Phabricator instance.

[SelDAGBuilder] Do not require simple VTs for constraints.
ClosedPublic

Authored by fhahn on Nov 18 2020, 7:16 AM.

Details

Summary

In some cases, the values passed to asm sideeffect calls cannot be
mapped directly to simple MVTs. Currently, we crash in the backend if
that happens. An example can be found in the @test_vector_too_large_r_m
test case, where we pass <9 x float> vectors. In practice, this can
happen in cases like the simple C example below.

using vec = float attribute((ext_vector_type(9)));
void f1 (vec m) {

asm volatile("" : "+r,m"(m) : : "memory");

}

One case that use "+r,m" constraints for arbitrary data types in
practice is google-benchmark's DoNotOptimize.

This patch updates visitInlineAsm so that it use MVT::Other for
constraints with complex VTs. It looks like the rest of the backend
correctly deals with that and properly legalizes the type.

And we still report an error if there are no registers to satisfy the
constraint.

Diff Detail

Event Timeline

fhahn created this revision.Nov 18 2020, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2020, 7:16 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Nov 18 2020, 7:16 AM
arsenm accepted this revision.Nov 18 2020, 7:19 AM
This revision is now accepted and ready to land.Nov 18 2020, 7:19 AM
This revision was landed with ongoing or failed builds.Nov 19 2020, 1:41 AM
This revision was automatically updated to reflect the committed changes.