This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Merge duplicate functionality between InstCombine and ValueTracking
ClosedPublic

Authored by yabash on May 6 2017, 1:11 PM.

Details

Summary

Merge overflow computation for signed add,
appearing both in InstCombine and ValueTracking.

As part of the merge,
cleanup the interface for overflow checks in InstCombine.

Diff Detail

Repository
rL LLVM

Event Timeline

yabash created this revision.May 6 2017, 1:11 PM
takuto.ikuta added inline comments.
lib/Analysis/ValueTracking.cpp
3523 ↗(On Diff #98080)

Can I ask you to remove std::moves?
These have no meaning here.

3537 ↗(On Diff #98080)

ditto.

craig.topper added inline comments.May 6 2017, 6:42 PM
lib/Analysis/ValueTracking.cpp
3523 ↗(On Diff #98080)

They do have meaning. APInt's operator+ is setup to reuse one of the APInts storage for this case.

takuto.ikuta added inline comments.May 6 2017, 8:10 PM
lib/Analysis/ValueTracking.cpp
3523 ↗(On Diff #98080)

Ah, I got. sorry for wrong comment.

yabash marked 4 inline comments as done.May 7 2017, 1:20 PM
craig.topper added inline comments.May 7 2017, 7:29 PM
lib/Transforms/InstCombine/InstCombineInternal.h
510 ↗(On Diff #98080)

Can you split the const correcting stuff out into a separate patch?

lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
426 ↗(On Diff #98080)

If we're adding new methods, let's follow coding standards and start with a lower case letter.

yabash updated this revision to Diff 98898.May 13 2017, 11:36 AM

Fix and rebase.

After this patch is committed I'll submit a patch to fix const correctness
and naming conventions for the existing methods.

yabash marked 2 inline comments as done.May 13 2017, 11:37 AM
This revision is now accepted and ready to land.May 13 2017, 10:39 PM

Craig can you help committing please?

This revision was automatically updated to reflect the committed changes.