[PATCH] D66484: [Attributor][NFCI] Avoid lookups when resolving returned values
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 10:16:26 PDT 2019
jdoerfert updated this revision to Diff 216190.
jdoerfert added a comment.
Remove accidentally included code
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66484/new/
https://reviews.llvm.org/D66484
Files:
llvm/lib/Transforms/IPO/Attributor.cpp
Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -683,13 +683,18 @@
/// return instructions that might return them.
DenseMap<Value *, SmallPtrSet<ReturnInst *, 2>> ReturnedValues;
+ /// Mapping to remember the number of returned values for a AAReturnedValues
+ /// object such that we can avoid updates if nothing changed.
+ DenseMap<const AAReturnedValues *, unsigned> NumReturnedValuesPerKnownAA;
+
+ /// Set of unresolved calls returned by the associated function.
SmallPtrSet<CallBase *, 8> UnresolvedCalls;
/// State flags
///
///{
- bool IsFixed;
- bool IsValidState;
+ bool IsFixed = false;
+ bool IsValidState = true;
///}
public:
@@ -775,7 +780,6 @@
/// See AbstractState::indicateOptimisticFixpoint(...).
ChangeStatus indicateOptimisticFixpoint() override {
IsFixed = true;
- IsValidState &= true;
return ChangeStatus::UNCHANGED;
}
@@ -976,6 +980,15 @@
if (Unresolved)
continue;
+ // Now track transitively returned values.
+ unsigned &NumRetAA = NumReturnedValuesPerKnownAA[&RetValAA];
+ if (NumRetAA == RetValAA.getNumReturnValues()) {
+ LLVM_DEBUG(dbgs() << "[AAReturnedValues] Skip RetValAA as it has not "
+ "changed since it was seen last\n");
+ continue;
+ }
+ NumRetAA = RetValAA.getNumReturnValues();
+
for (auto &RetValAAIt : RetValAA.returned_values()) {
Value *RetVal = RetValAAIt.first;
if (Argument *Arg = dyn_cast<Argument>(RetVal)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66484.216190.patch
Type: text/x-patch
Size: 1658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/60fcb7a7/attachment.bin>
More information about the llvm-commits
mailing list