[llvm] 7211dbd - [Attributor][NFCI] Remove non-deterministic behavior and debug output
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 21:28:39 PST 2022
Author: Johannes Doerfert
Date: 2022-03-10T23:27:47-06:00
New Revision: 7211dbd01da3a0e2f3550e1987291b3c84f7ffc6
URL: https://github.com/llvm/llvm-project/commit/7211dbd01da3a0e2f3550e1987291b3c84f7ffc6
DIFF: https://github.com/llvm/llvm-project/commit/7211dbd01da3a0e2f3550e1987291b3c84f7ffc6.diff
LOG: [Attributor][NFCI] Remove non-deterministic behavior and debug output
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 7af8f38e04646..2f7630a9820ea 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1553,7 +1553,7 @@ struct Attributor {
/// is used, e.g., to replace \p II with a call, after information was
/// manifested.
void registerInvokeWithDeadSuccessor(InvokeInst &II) {
- InvokeWithDeadSuccessor.push_back(&II);
+ InvokeWithDeadSuccessor.insert(&II);
}
/// Record that \p I is deleted after information was manifested. This also
@@ -2022,7 +2022,7 @@ struct Attributor {
/// (\see registerFunctionSignatureRewrite) and return Changed if the module
/// was altered.
ChangeStatus
- rewriteFunctionSignatures(SmallPtrSetImpl<Function *> &ModifiedFns);
+ rewriteFunctionSignatures(SmallSetVector<Function *, 8> &ModifiedFns);
/// Check if the Attribute \p AA should be seeded.
/// See getOrCreateAAFor.
@@ -2054,7 +2054,7 @@ struct Attributor {
/// Set of functions for which we modified the content such that it might
/// impact the call graph.
- SmallPtrSet<Function *, 8> CGModifiedFunctions;
+ SmallSetVector<Function *, 8> CGModifiedFunctions;
/// Information about a dependence. If FromAA is changed ToAA needs to be
/// updated as well.
@@ -2091,17 +2091,17 @@ struct Attributor {
/// Uses we replace with a new value after manifest is done. We will remove
/// then trivially dead instructions as well.
- DenseMap<Use *, Value *> ToBeChangedUses;
+ SmallMapVector<Use *, Value *, 32> ToBeChangedUses;
/// Values we replace with a new value after manifest is done. We will remove
/// then trivially dead instructions as well.
- DenseMap<Value *, std::pair<Value *, bool>> ToBeChangedValues;
+ SmallMapVector<Value *, std::pair<Value *, bool>, 32> ToBeChangedValues;
/// Instructions we replace with `unreachable` insts after manifest is done.
- SmallDenseSet<WeakVH, 16> ToBeChangedToUnreachableInsts;
+ SmallSetVector<WeakVH, 16> ToBeChangedToUnreachableInsts;
/// Invoke instructions with at least a single dead successor block.
- SmallVector<WeakVH, 16> InvokeWithDeadSuccessor;
+ SmallSetVector<WeakVH, 16> InvokeWithDeadSuccessor;
/// A flag that indicates which stage of the process we are in. Initially, the
/// phase is SEEDING. Phase is changed in `Attributor::run()`
@@ -2118,10 +2118,10 @@ struct Attributor {
/// Functions, blocks, and instructions we delete after manifest is done.
///
///{
- SmallPtrSet<Function *, 8> ToBeDeletedFunctions;
- SmallPtrSet<BasicBlock *, 8> ToBeDeletedBlocks;
SmallPtrSet<BasicBlock *, 8> ManifestAddedBlocks;
- SmallDenseSet<WeakVH, 8> ToBeDeletedInsts;
+ SmallSetVector<Function *, 8> ToBeDeletedFunctions;
+ SmallSetVector<BasicBlock *, 8> ToBeDeletedBlocks;
+ SmallSetVector<WeakVH, 8> ToBeDeletedInsts;
///}
/// Callback to get an OptimizationRemarkEmitter from a Function *.
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 41302d747fc61..18dc313bb90e8 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2440,7 +2440,7 @@ bool Attributor::shouldSeedAttribute(AbstractAttribute &AA) {
}
ChangeStatus Attributor::rewriteFunctionSignatures(
- SmallPtrSetImpl<Function *> &ModifiedFns) {
+ SmallSetVector<Function *, 8> &ModifiedFns) {
ChangeStatus Changed = ChangeStatus::UNCHANGED;
for (auto &It : ArgumentReplacementMap) {
@@ -2624,7 +2624,7 @@ ChangeStatus Attributor::rewriteFunctionSignatures(
// If the old function was modified and needed to be reanalyzed, the new one
// does now.
- if (ModifiedFns.erase(OldFn))
+ if (ModifiedFns.remove(OldFn))
ModifiedFns.insert(NewFn);
Changed = ChangeStatus::CHANGED;
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 982fcb3b32833..7a755cae2c889 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -5318,7 +5318,7 @@ struct AAValueSimplifyImpl : AAValueSimplify {
/// See AbstractAttribute::getAsStr().
const std::string getAsStr() const override {
LLVM_DEBUG({
- errs() << "SAV: " << SimplifiedAssociatedValue << " ";
+ errs() << "SAV: " << (bool)SimplifiedAssociatedValue << " ";
if (SimplifiedAssociatedValue && *SimplifiedAssociatedValue)
errs() << "SAV: " << **SimplifiedAssociatedValue << " ";
});
More information about the llvm-commits
mailing list