This is an archive of the discontinued LLVM Phabricator instance.

SelectionDAG: Don't do libcall on div/rem if divrem is custom
ClosedPublic

Authored by jvesely on Feb 20 2015, 4:35 PM.

Details

Summary

This removes the need for backends to set DIV/REM pairs to custom if they implement divrem

Diff Detail

Repository
rL LLVM

Event Timeline

jvesely updated this revision to Diff 20445.Feb 20 2015, 4:35 PM
jvesely retitled this revision from to SelectionDAG: Don't do libcall on div/rem if divrem is custom.
jvesely updated this object.
jvesely edited the test plan for this revision. (Show Details)
jvesely set the repository for this revision to rL LLVM.
jvesely added a subscriber: Unknown Object (MLST).
chfast added a subscriber: chfast.Apr 5 2015, 5:27 AM

This needs a test case.

the following patch connects tests for r600 that exercise this codepath

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150406/270202.html

ping. are the r600 tests not good enough?

ab added a subscriber: ab.May 22 2015, 4:20 PM
ab added inline comments.
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
2185 ↗(On Diff #20445)

TargetLoweringBase:: -> TargetLowering::

2186 ↗(On Diff #20445)

RES -> Res

Also, what about 'SDNode *Res'? Doing an explicit SDValue(Res, 0/1) is clearer, I think.

2187 ↗(On Diff #20445)

I see we have Ops[2] a few lines down, can you move that above and just pass it here?

jvesely updated this revision to Diff 26369.May 23 2015, 6:26 AM

v2:
TargetLoweringBase:: -> TargetLowering::
Use Ops array

i considered using SDNode, but the line
SDNode *Res = DAG.getNode(..................).getNode();
looked a bit long/awkward.
I can add the change in v3 if you really prefer it that way.

ab accepted this revision.May 26 2015, 4:29 PM
ab added a reviewer: ab.

I'm not a big fan, but I don't have a better alternative, so, LGTM, thanks!

i considered using SDNode, but the line
SDNode *Res = DAG.getNode(..................).getNode();
looked a bit long/awkward.

Fair enough. How about using an explicit Res.getValue(0) for DIV instead?

This revision is now accepted and ready to land.May 26 2015, 4:29 PM
ab added inline comments.May 26 2015, 4:29 PM
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
2501 ↗(On Diff #26369)

Also, unnecessary newline.

This revision was automatically updated to reflect the committed changes.