This is an archive of the discontinued LLVM Phabricator instance.

Skeleton for the IR level pass to perform 64bit Integer Division
Needs ReviewPublic

Authored by Uthkarsh on Mar 10 2016, 5:23 PM.

Details

Summary

This contains the required pass for performing the 64bit integer division at the IR level. The algorithm has not been incorporated yet but just the skeleton is given for review.

Diff Detail

Event Timeline

Uthkarsh updated this revision to Diff 50381.Mar 10 2016, 5:23 PM
Uthkarsh retitled this revision from to Skeleton for the IR level pass to perform 64bit Integer Division.
Uthkarsh updated this object.
Uthkarsh added reviewers: arsenm, tstellarAMD.
Uthkarsh added a subscriber: llvm-commits.
arsenm added inline comments.Mar 10 2016, 5:46 PM
include/llvm/CodeGen/Passes.h
395–397

These parts touching generic code should be removed since it is a backend pass now. The IDs etc. declarations should be only in AMDGPU.h

lib/Target/AMDGPU/AMDGPU.h
88

Description comments should be in the pass file instead

lib/Target/AMDGPU/AMDGPU64bitDivision.cpp
8 ↗(On Diff #50381)

There should not be a free function like this. This should be a method of the pass

lib/Target/AMDGPU/AMDGPU64bitDivision.h
1–2

This header is unnecessary, this can be done entirely in the one cpp file

3–6

You don't need these

8–14

Also any of these

lib/Target/AMDGPU/AMDGPUISelLowering.cpp
256–257

This looks like an unrelated change, and is also incorrect since this should work already. i32 has an instruction and i64 should already be expanded

257–260

Random whitespace change

lib/Target/AMDGPU/AMDGPUIntegerDivisionPass.cpp
1

Name out of date

9–11

This should have a description or be removed

13

AMDGPU.h should be the first included file

27

This should be all lower case and - separated, otherwise it won't really work as a -debug-only= argument

37

This should be removed

67

Dead code

70–74

Dead code

90–91

You're going to need to pre-increment this pointer to avoid iterator invalidation issues when you delete the original div instruction

93

You can pre-increment the iterators to avoid skipping back to the beginning

106

You can do Type->isIntegerTy(64)

150

This shouldn't be here

lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
39 ↗(On Diff #50381)

Random whitespace

56 ↗(On Diff #50381)

Comment not needed

207 ↗(On Diff #50381)

Comments should never include names

208 ↗(On Diff #50381)

I think this should be moved to addCodeGenPrepare after TargetPassConfig::addCodeGenPrepare()

include/llvm/CodeGen/Passes.h
395–397

Since this is a target specific pass the ID should be defined in AMDGPU.h like the other AMDGPU passes.

649–650

This should go in AMDGPU.h too.

include/llvm/InitializePasses.h
152

This in AMDGPU.h too.

include/llvm/LinkAllPasses.h
148–149

I don't think this is needed.

Uthkarsh updated this revision to Diff 50496.Mar 11 2016, 3:50 PM

Have modified most of the requested changes.

Uthkarsh updated this revision to Diff 50497.Mar 11 2016, 3:54 PM

Unnecessary comments deleted.

arsenm edited edge metadata.Mar 21 2016, 4:52 PM

The current diff seems to be just the comment changes

Uthkarsh updated this revision to Diff 51822.Mar 28 2016, 12:58 PM
Uthkarsh edited edge metadata.

Consolidated diff of the previous commits, along with the changes.

arsenm resigned from this revision.Feb 22 2019, 6:35 AM