This is an archive of the discontinued LLVM Phabricator instance.

[CVP] Simplify cmp of local phi node
ClosedPublic

Authored by nikic on Jan 3 2020, 9:49 AM.

Details

Summary

CVP currently does not simplify cmps with instructions in the same block, because LVI getPredicateAt() currently does not really provide much useful information for that case (D69686 would change that, but is stuck.) However, if the instruction is a Phi node, then LVI can compute the result of the predicate by threading it into the predecessor blocks, which allows it simplify some conditions that nothing else can handle. Relevant code: https://github.com/llvm/llvm-project/blob/6d6a4590c5d4c7fc7445d72fe685f966b0a8cafb/llvm/lib/Analysis/LazyValueInfo.cpp#L1904-L1927

The example in the test case is reduced from a Rust test case that sees a major perf regression in LLVM 10 (https://bugs.llvm.org/show_bug.cgi?id=44461). This patch addresses part of the regression (though not all of it).

Diff Detail

Event Timeline

nikic created this revision.Jan 3 2020, 9:49 AM
alex added a subscriber: alex.Jan 5 2020, 2:16 PM
nikic edited the summary of this revision. (Show Details)Jan 13 2020, 12:49 AM

Ping

reames accepted this revision.Feb 25 2020, 10:06 AM

LGTM.

This revision is now accepted and ready to land.Feb 25 2020, 10:06 AM
This revision was automatically updated to reflect the committed changes.