Page MenuHomePhabricator

[GlobalISel][NFC] Gardening: Factor out more intrinsics into simple intrinsics
AcceptedPublic

Authored by paquette on Feb 12 2019, 10:29 AM.

Details

Summary

Found another place where we can just factor out a bunch of intrinsics and make it a bit easier to add more of these. The only difference between a "simple intrinsic" and, say, the overflow intrinsics is that simple intrinsics only have a single result.

This teaches translateSimpleIntrinsic to handle an arbitrary number of destination registers. Then we can factor out all of the overflow intrinsics, and delete translateOverflowIntrinsic entirely. Also makes the overflow intrinsics respect IR flags, which weren't being copied over in translateOverflowIntrinsic.

By doing this, we can add IRTranslator support for any intrinsic that can be "straight-line" translated by adding it to getSimpleIntrinsicOpcode.

Diff Detail

Event Timeline

paquette created this revision.Feb 12 2019, 10:29 AM
arsenm added inline comments.Feb 12 2019, 11:17 AM
lib/CodeGen/GlobalISel/IRTranslator.cpp
859

I don't think you need to copy the ArrayRef to a SmallVector, you should be able to use the ArrayRef as is

arsenm added inline comments.Feb 12 2019, 11:19 AM
lib/CodeGen/GlobalISel/IRTranslator.cpp
859

Actually since this is DstOp, and not unsigned, you do. Maybe this should be moved as an overload in MachineIRBuilder though. You also don't need the llvm::

aemerson added inline comments.Feb 18 2019, 1:38 PM
lib/CodeGen/GlobalISel/IRTranslator.cpp
859

Seems like SrcOp and DstOp should be inside MachineIRBuilder instead of in the llvm namespace anyway.

arsenm added a comment.Sep 9 2019, 9:12 AM

Is this still needed?

arsenm accepted this revision.Jan 9 2020, 7:37 AM

LGTM

This revision is now accepted and ready to land.Jan 9 2020, 7:37 AM