This is an archive of the discontinued LLVM Phabricator instance.

DAGCombiner: Add form of isFPExtFree to check uses
ClosedPublic

Authored by arsenm on Aug 14 2017, 12:17 PM.

Details

Summary

I want to be able to specify this, but only for a specific user
instruction.

Diff Detail

Event Timeline

arsenm created this revision.Aug 14 2017, 12:17 PM
arsenm updated this revision to Diff 111059.Aug 14 2017, 1:46 PM

Just add an opcode field to be sure it's only used here. It's a lot simpler patch and sufficient for my needs rather than updating all of the individual places this is needed

arsenm updated this revision to Diff 111062.Aug 14 2017, 1:49 PM

Fix default implementation

RKSimon added a subscriber: RKSimon.

Given its limited use I don't see why we shouldn't just update the existing isFPExtFree to take Opcode, SrcVT and DstVT - all of which may be useful.

arsenm added a comment.Oct 2 2017, 6:13 PM

Given its limited use I don't see why we shouldn't just update the existing isFPExtFree to take Opcode, SrcVT and DstVT - all of which may be useful.

The problem with the opcode is this does have a caller from the IR path from codegenprepare (although this feature doesn't seem to be hit by any tests in tree), so there needs to at least be a different one for that. Adding the other VT just makes this messier, since now it is more context dependent.

arsenm updated this revision to Diff 117841.Oct 5 2017, 9:47 AM

Also update fsub case

efriedma edited edge metadata.Oct 6 2017, 12:37 PM

We should provide both the source and destination VT for any query like this... should be easy to provide even on the IR path.

But anyway, there's a difference between a free fp-extend (like on PowerPC or x87, where the value actually doesn't require a conversion at all), and an fp-extend which can be folded into other arithmetic operations. It probably doesn't make sense to make them use the same API. That said, the version checking whether an extend is foldable should probably have a different name.

arsenm updated this revision to Diff 118142.Oct 7 2017, 10:35 AM

Add source type and rename

RKSimon edited edge metadata.Oct 8 2017, 4:17 AM

A few style comments, but its up to whether @efriedma and the PPC guys are happy with this change.

include/llvm/Target/TargetLowering.h
2125

Add assertion message

2134

You can drop this comment.

2135

Add assertion message

lib/Target/PowerPC/PPCISelLowering.cpp
13277

Add assertion message

It would appear to me that the PPC-only portion of this is NFC since it'll still return true for any floating point destination type. So I would say that the PPC back end is fine with those (as long as the assert gets a message :)).
However, shouldn't this patch have a test case?

arsenm updated this revision to Diff 118883.Oct 12 2017, 9:30 PM

Add assert messages

It would appear to me that the PPC-only portion of this is NFC since it'll still return true for any floating point destination type. So I would say that the PPC back end is fine with those (as long as the assert gets a message :)).
However, shouldn't this patch have a test case?

D38510 includes the implementation that uses it

RKSimon accepted this revision.Oct 13 2017, 4:00 AM

LGTM - naturally D38510 needs updating the new API

This revision is now accepted and ready to land.Oct 13 2017, 4:00 AM
arsenm closed this revision.Oct 13 2017, 12:56 PM

r315740