-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ValueTracking] Filter out non-interesting conditions #118493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
class DomConditionCache { | ||
private: | ||
/// A map of values about which a branch might be providing information. | ||
using AffectedValuesMap = DenseMap<Value *, SmallVector<BranchInst *, 1>>; | ||
using AffectedValuesMap = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as it seems like conditionsFor is called for one DomConditionFlag value at a time maybe better add the flag as en argument and change map to store the flag as part of the key to the map?
DenseMap<std::pair<Value *, DomConditionFlag>, SmallVector<BranchInst *, 1>>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm noticed now that you mentioned that it was the calls to registerBranch that was the problem in #117442 (comment) and this will result in more work then.
but if it is the registerBranch that is the problem I assume that any filtering added will result in worse compile time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From some quick profiling, the impact isn't from registerBranch, but from extra DT queries in computeKnownBits. I think in principle this patch should still help as long as we don't add comparisons where both sides are variables to the KnownBits category (338d7fc#r152360307).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
652a01a
to
4b0feb4
Compare
This patch avoids adding RHS for comparisons with two variable operands (#118493 (comment)). Instead, we iterate over related dominating conditions of both V1 and V2 in `isKnownNonEqualFromContext`, as suggested by goldsteinn (#117442 (comment)). Compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=c6d95c441a29a45782ff72d6cb82839b86fd0e4a&to=88464baedd7b1731281eaa0ce4438122b4d218a7&stat=instructions:u
…7388) This patch avoids adding RHS for comparisons with two variable operands (llvm/llvm-project#118493 (comment)). Instead, we iterate over related dominating conditions of both V1 and V2 in `isKnownNonEqualFromContext`, as suggested by goldsteinn (llvm/llvm-project#117442 (comment)). Compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=c6d95c441a29a45782ff72d6cb82839b86fd0e4a&to=88464baedd7b1731281eaa0ce4438122b4d218a7&stat=instructions:u
This patch avoids adding RHS for comparisons with two variable operands (llvm#118493 (comment)). Instead, we iterate over related dominating conditions of both V1 and V2 in `isKnownNonEqualFromContext`, as suggested by goldsteinn (llvm#117442 (comment)). Compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=c6d95c441a29a45782ff72d6cb82839b86fd0e4a&to=88464baedd7b1731281eaa0ce4438122b4d218a7&stat=instructions:u
This patch avoids adding RHS for comparisons with two variable operands (llvm#118493 (comment)). Instead, we iterate over related dominating conditions of both V1 and V2 in `isKnownNonEqualFromContext`, as suggested by goldsteinn (llvm#117442 (comment)). Compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=c6d95c441a29a45782ff72d6cb82839b86fd0e4a&to=88464baedd7b1731281eaa0ce4438122b4d218a7&stat=instructions:u
This patch avoids adding RHS for comparisons with two variable operands (llvm#118493 (comment)). Instead, we iterate over related dominating conditions of both V1 and V2 in `isKnownNonEqualFromContext`, as suggested by goldsteinn (llvm#117442 (comment)). Compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=c6d95c441a29a45782ff72d6cb82839b86fd0e4a&to=88464baedd7b1731281eaa0ce4438122b4d218a7&stat=instructions:u
Address issue #117442 (comment)