This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] LegalizerHelper - Extract widenScalarAddoSubo method
ClosedPublic

Authored by porglezomp on Jan 20 2021, 4:55 AM.

Details

Summary

The widenScalar implementation for signed and unsigned overflowing
operations were very similar: both are checked by truncating the result
and then re-sign/zero-extending it and checking that it matches the
computed operation.

Using a truncate + zero-extend for the unsigned case instead of manually
producing the AND instruction like before leads to an extra copy
instruction during legalization, but this should be harmless.

Diff Detail

Event Timeline

porglezomp created this revision.Jan 20 2021, 4:55 AM
porglezomp requested review of this revision.Jan 20 2021, 4:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2021, 4:55 AM
This revision is now accepted and ready to land.Jan 20 2021, 9:44 AM

Applying this patch to trunk on top of the previous two tests doesn't pass the test suite.

Failed Tests (5):
  LLVM-Unit :: CodeGen/GlobalISel/./GlobalISelTests/AArch64GISelMITest.WidenUADDO
  LLVM-Unit :: CodeGen/GlobalISel/./GlobalISelTests/AArch64GISelMITest.WidenUSUBO
  LLVM :: CodeGen/AArch64/legalize-uaddo.mir
  LLVM :: CodeGen/AMDGPU/GlobalISel/legalize-uaddo.mir
  LLVM :: CodeGen/AMDGPU/GlobalISel/legalize-usubo.mir

Could you double check and update?

Update tests for changed legalization

This revision was landed with ongoing or failed builds.Jan 22 2021, 2:09 PM
This revision was automatically updated to reflect the committed changes.
porglezomp reopened this revision.Jan 22 2021, 7:04 PM

The buildbot with the UBSan tests passed for the first commit in this stack, so I think this should be safe to re-land http://lab.llvm.org:8011/#/builders/77/builds/3112

This revision is now accepted and ready to land.Jan 22 2021, 7:04 PM