This is an archive of the discontinued LLVM Phabricator instance.

name change: isPow2DivCheap -> isPow2SDivCheap
ClosedPublic

Authored by spatel on Aug 21 2014, 11:37 AM.

Details

Summary

While looking at http://reviews.llvm.org/D4971, my understanding of the code was slowed down by the ambiguous:
isPow2DivCheap

That name doesn't specify signed or unsigned.

Lazy as I am, I eventually read the function and variable comments. It turns out that this is strictly about signed div. But I discovered that the comments are wrong:

srl/add/sra

is not the general sequence for signed integer division by power-of-2. We need one more 'sra':

sra/srl/add/sra

That's the sequence produced in DAGCombiner. The first 'sra' may be removed when dividing by exactly '2', but that's a special case.

This patch corrects the comments, changes the name of the flag bit, and changes the name of the accessor methods.

No functional change intended.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 12788.Aug 21 2014, 11:37 AM
spatel retitled this revision from to name change: isPow2DivCheap -> isPow2SDivCheap.
spatel updated this object.
spatel edited the test plan for this revision. (Show Details)
spatel added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Aug 21 2014, 12:12 PM
hfinkel edited edge metadata.

LGTM. Thanks!

This revision is now accepted and ready to land.Aug 21 2014, 12:12 PM
andreadb accepted this revision.Aug 21 2014, 1:27 PM
andreadb edited edge metadata.

LGTM too.

spatel closed this revision.Aug 21 2014, 3:41 PM
spatel updated this revision to Diff 12809.

Closed by commit rL216237 (authored by @spatel).