[Attributor][NFCI] Remove non-deterministic behavior and debug output

This commit is contained in:
Johannes Doerfert 2022-03-08 16:35:23 -06:00
parent 1f3a8d58a6
commit 7211dbd01d
3 changed files with 13 additions and 13 deletions

View file

@ -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 @@ private:
/// (\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 @@ private:
/// 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 @@ private:
/// 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 @@ private:
/// 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 *.

View file

@ -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;

View file

@ -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 << " ";
});