This is an archive of the discontinued LLVM Phabricator instance.

[NaryReassociate] enhances nsw by leveraging @llvm.assume
ClosedPublic

Authored by jingyue on Jun 29 2015, 4:18 PM.

Details

Summary

nsw are flaky and can often be removed by optimizations. This patch enhances
nsw by leveraging @llvm.assume in the IR. Specifically, NaryReassociate now
understands that

assume(a + b >= 0) && assume(a >= 0) ==> a +nsw b

As a result, it can split more sext(a + b) into sext(a) + sext(b) for CSE.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 28728.Jun 29 2015, 4:18 PM
jingyue retitled this revision from to [NaryReassociate] enhances nsw by leveraging @llvm.assume.
jingyue updated this object.
jingyue edited the test plan for this revision. (Show Details)
jingyue added reviewers: broune, meheff.
jingyue added a subscriber: Unknown Object (MLST).
meheff edited edge metadata.Jun 30 2015, 5:14 PM

LGTM. Just one nit comment/question.

test/Transforms/NaryReassociate/NVPTX/nary-gep.ll
39

Should all "CHECK"s be replaced with "check"? or none?

jingyue added inline comments.Jun 30 2015, 8:27 PM
test/Transforms/NaryReassociate/NVPTX/nary-gep.ll
39

Didn't mean this at all. I must have hit some magic button! :)

jingyue updated this revision to Diff 28841.Jun 30 2015, 8:33 PM
jingyue edited edge metadata.

fixed typos

jingyue updated this revision to Diff 28842.Jun 30 2015, 8:38 PM

fixed another typo

This revision was automatically updated to reflect the committed changes.