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 ↗(On Diff #50381)

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
89

Description comments should be in the pass file instead

lib/Target/AMDGPU/AMDGPU64bitDivision.cpp
9

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

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

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

4–7

You don't need these

9–15

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

259–261

Random whitespace change

lib/Target/AMDGPU/AMDGPUIntegerDivisionPass.cpp
2

Name out of date

10–12

This should have a description or be removed

14

AMDGPU.h should be the first included file

28

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

38

This should be removed

68

Dead code

71–75

Dead code

91–92

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

94

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

107

You can do Type->isIntegerTy(64)

151

This shouldn't be here

lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
39

Random whitespace

56

Comment not needed

207

Comments should never include names

208

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

include/llvm/CodeGen/Passes.h
395–397 ↗(On Diff #50381)

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

652–653 ↗(On Diff #50381)

This should go in AMDGPU.h too.

include/llvm/InitializePasses.h
152 ↗(On Diff #50381)

This in AMDGPU.h too.

include/llvm/LinkAllPasses.h
148–149 ↗(On Diff #50381)

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