This is an archive of the discontinued LLVM Phabricator instance.

[InlineCost] Simplify more 'and' and 'or' operations.
ClosedPublic

Authored by mcrosier on Jul 25 2017, 2:13 PM.

Details

Summary

The idea is fairly straight forward. The primary advantage of this simplification is that it can cause parts of the CFG to become unreachable. See the fifth test case as an example.

Chad

Diff Detail

Event Timeline

mcrosier created this revision.Jul 25 2017, 2:13 PM
efriedma added inline comments.
lib/Analysis/InlineCost.cpp
811

The isIntegerTy(1) check seems unnecessary.

mcrosier updated this revision to Diff 108161.Jul 25 2017, 2:38 PM
mcrosier retitled this revision from [InlineCost] Simplify logical 'and' and 'or' operations. to [InlineCost] Simplify more 'and' and 'or' operations..
mcrosier edited the summary of this revision. (Show Details)

Address Geoff's offline comments.
-Remove the constraint that the 'and' or 'or' is operating on an i1 value.

mcrosier marked an inline comment as done.Jul 25 2017, 2:40 PM
mcrosier added inline comments.
lib/Analysis/InlineCost.cpp
811

Yup! I've uploaded a new patch.

mcrosier updated this revision to Diff 108264.Jul 26 2017, 6:13 AM
mcrosier marked an inline comment as done.

Update comments and minor formatting improvements.

chandlerc accepted this revision.Aug 1 2017, 2:53 PM

LGTM

It'd be nice if we could enhance the generic code to handle this and other fundamental identities, but still, seems fine and plugs a hole.

This revision is now accepted and ready to land.Aug 1 2017, 2:53 PM
This revision was automatically updated to reflect the committed changes.