This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Constant fold VCTP intrinsics
ClosedPublic

Authored by dmgreen on Jul 18 2020, 2:58 PM.

Details

Summary

We can sometimes get into the situation where the operand to a vctp intrinsic becomes constant, such as after a loop is fully unrolled. This adds the constant folding needed for them, allowing them to simplify away and hopefully simplifying remaining instructions.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 18 2020, 2:58 PM
nikic added a subscriber: nikic.Jul 19 2020, 6:10 AM

Why is this in InstCombine rather than ConstantFolding?

Ah. Sure, I think I can move it there. For some reason I was under the impression that constant folding did not handle target intrinsics, but I see there are some x86 and amd intrinsics in there already.

dmgreen updated this revision to Diff 279109.Jul 19 2020, 1:39 PM

Moved to constant folding.

SjoerdMeijer accepted this revision.Jul 20 2020, 9:07 AM

With this now in ConstantFolding, this looks good to me. Please wait a day in case there are more comments.

This revision is now accepted and ready to land.Jul 20 2020, 9:07 AM

We might want to look at migrating the target-specific code into the target, similar to what we're doing for target-specific intrinsics in instcombine.

llvm/lib/Analysis/ConstantFolding.cpp
2765 ↗(On Diff #279109)

Are these just ConstantInt::getTrue() and ConstantInt::getFalse()?

We might want to look at migrating the target-specific code into the target, similar to what we're doing for target-specific intrinsics in instcombine.

Yep. Sounds sensible to me. (That's one of the reason's I didn't think ConstantFolding handled target intrinsics). The instcombine side should probably go in first though.

This revision was automatically updated to reflect the committed changes.