This is an archive of the discontinued LLVM Phabricator instance.

Refactoring SimplifyLibCalls to remove static initializers and generally cleaning up the code.
ClosedPublic

Authored by beanz on Sep 15 2014, 4:45 PM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 13735.Sep 15 2014, 4:45 PM
beanz retitled this revision from to Refactoring SimplifyLibCalls to remove static initializers and generally cleaning up the code..
beanz updated this object.
beanz edited the test plan for this revision. (Show Details)
beanz added a reviewer: chandlerc.
beanz added a subscriber: Unknown Object (MLST).

LGTM otherwise.

lib/Transforms/Utils/SimplifyLibCalls.cpp
114 ↗(On Diff #13735)

I think this needs a more descriptive name now that it is not contained in a class with a self-documenting name.

321 ↗(On Diff #13735)

I think the old formatting was more readable here.

It mostly seems reasonable to me, but I don't know this area of the code, and do not feel at all comfortable giving an LGTM, so someone more experienced should look at it.

My only complaint about the patch as a whole is that it could probably have been cut in several parts, in particular all the whitespace/formatting changes could have been a separate patch and it would have made reviewing much easier.

Nitpicks inline.

include/llvm/Transforms/Utils/SimplifyLibCalls.h
57 ↗(On Diff #13735)

Could you give a comment here for the intended use/semantics for this method ?
Does it need to be public ?

lib/Transforms/Utils/SimplifyLibCalls.cpp
1626 ↗(On Diff #13735)

The comment here got mangled by the reformatting.

1902 ↗(On Diff #13735)

This looks like a behavior change. If so it should probably be in a separate patch (this one is already rather bulky).

2046 ↗(On Diff #13735)

Same as before, this does not look like just a part of the refactor.

2071 ↗(On Diff #13735)

This could perhaps be replaced by an initializer list ?

2076 ↗(On Diff #13735)

Is this necessary ? If it does nothing I would be tempted to just keep the default destructor.

beanz added a comment.Sep 16 2014, 6:12 PM

I'm going to work on revisions based on the feedback, but I had a few comments.

lib/Transforms/Utils/SimplifyLibCalls.cpp
1902 ↗(On Diff #13735)

This actually isn't a behavior change. It was part of LibCallOptimization::optimizeCall. Since the refactoring removed that method I've moved the check here.

2046 ↗(On Diff #13735)

This actually isn't a behavior change. It was also part of LibCallOptimization::optimizeCall.

beanz updated this revision to Diff 13800.Sep 17 2014, 1:45 PM
  • Renamed isFoldable to be more descriptive
  • Cleaned up constructors and destructors
  • Added some comments
  • Fixed formatting in a few places where clang-format went a bit nuts
resistor accepted this revision.Sep 17 2014, 1:49 PM
resistor added a reviewer: resistor.

LGTM.

This revision is now accepted and ready to land.Sep 17 2014, 1:49 PM
Diffusion closed this revision.Sep 17 2014, 2:05 PM
Diffusion updated this revision to Diff 13801.

Closed by commit rL217982 (authored by cbieneman).

llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp