This is an archive of the discontinued LLVM Phabricator instance.

Constant fold llvm.expect(c, ...) -> c
AbandonedPublic

Authored by pete on Jan 25 2015, 9:37 PM.

Details

Reviewers
hfinkel
Summary

This teaches the constant folder that an llvm.expect intrinsic with a constant as the first operand will return that constant.

This reduces the size of an LTO'd llc by over 1% due to branches which can be removed once the constant is propagated.

Diff Detail

Event Timeline

pete updated this revision to Diff 18739.Jan 25 2015, 9:37 PM
pete retitled this revision from to Constant fold llvm.expect(c, ...) -> c.
pete updated this object.
pete edited the test plan for this revision. (Show Details)
pete added a reviewer: hfinkel.
pete added a subscriber: Unknown Object (MLST).
reames added a subscriber: reames.Jan 26 2015, 10:14 AM

LGTM w/the addition of a negative test. (i.e. show constant fold not happening when the first operand isn't constant)

pete abandoned this revision.Jan 26 2015, 11:55 AM

http://reviews.llvm.org/D7183 supersedes this. Thanks to Chandler for the idea.