This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Add scalar widening for G_MERGE_VALUES destination
ClosedPublic

Authored by paquette on Jul 26 2021, 11:40 AM.

Details

Summary

This adds support for the case where

WideSize = DstSize + K * SrcSize

In this case, we can pad the G_MERGE_VALUES instruction with K extra undef values with width SrcSize. Then the destination can be handled via widenScalarDst.

Diff Detail

Event Timeline

paquette created this revision.Jul 26 2021, 11:40 AM
paquette requested review of this revision.Jul 26 2021, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2021, 11:40 AM
Herald added a subscriber: wdng. · View Herald Transcript
aemerson accepted this revision.Jul 26 2021, 3:01 PM

LGTM.

This revision is now accepted and ready to land.Jul 26 2021, 3:01 PM
This revision was landed with ongoing or failed builds.Jul 26 2021, 5:02 PM
This revision was automatically updated to reflect the committed changes.
hctim added a subscriber: hctim.Jul 26 2021, 7:51 PM

Looks like this patch broke the MSan buildbots:

https://lab.llvm.org/buildbot/#/builders/5/builds/9643

You might find the instructions at https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild helpful, as the MSan bot requires multiple stages of compilation.

FAIL: LLVM :: CodeGen/AArch64/GlobalISel/legalize-constant.mir (77964 of 77964)
******************** TEST 'LLVM :: CodeGen/AArch64/GlobalISel/legalize-constant.mir' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -O0 -mtriple aarch64 -run-pass=legalizer -verify-machineinstrs /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir -o - | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir
--
Exit Code: 2
Command Output (stderr):
--
==77619==ERROR: MemorySanitizer: requested allocation size 0x2827fffd8 exceeds maximum supported size of 0x200000000
    <empty stack>
==77619==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: MemorySanitizer: allocation-size-too-big
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/legalize-constant.mir
--
********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  LLVM :: CodeGen/AArch64/GlobalISel/legalize-constant.mir
thakis added a subscriber: thakis.Jul 26 2021, 8:20 PM

Also made that same test hang in an infinite loop on my linux box, and fail on my m1 mac: http://45.33.8.238/macm1/14850/step_11.txt

Not sure why I didn't catch that.

Looks like this infinite loops with the artifact combiner, which tries to combine G_TRUNC(G_MERGE_VALUES) -> G_MERGE_VALUES. :(