This is an archive of the discontinued LLVM Phabricator instance.

[CallSiteSplitting] Simplify isPredicateOnPHI & continue checking PHIs.
ClosedPublic

Authored by fhahn on Mar 30 2020, 1:43 PM.

Details

Summary

As pointed out by @thakis, currently CallSiteSplitting bails out after
checking the first PHI node. We should check all PHI nodes, until we
find one where call site splitting is beneficial.

This patch also slightly simplifies the code using BasicBlock::phis().

Diff Detail

Event Timeline

fhahn created this revision.Mar 30 2020, 1:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2020, 1:43 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
davidxl added inline comments.Mar 30 2020, 2:28 PM
llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
437

Should this be relaxed too -- allow splitting when there is one constant value?

fhahn marked an inline comment as done.Apr 1 2020, 2:33 AM
fhahn added inline comments.
llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
437

I think we could , given that we also split if we find an argument only to be constant in one predecessor due to a condition. But I think that might be better done as a potential follow-up?

davidxl accepted this revision.Apr 1 2020, 8:20 AM

lgtm

This revision is now accepted and ready to land.Apr 1 2020, 8:20 AM
This revision was automatically updated to reflect the committed changes.