[g-arc-opts] Implement the merge functions to complete Stage 2 of global arc opts.

Also fixed a small bug related to how we handle arguments. We were not
clearing the state of the argument when we saw a potential decrement of
the argument.

<rdar://problem/17013194>

Swift SVN r18706
This commit is contained in:
Michael Gottesman
2014-06-05 04:35:14 +00:00
parent 814274a05d
commit c2b2e52260
5 changed files with 941 additions and 56 deletions

View File

@@ -15,6 +15,7 @@
#include "swift/SIL/SILValue.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SetVector.h"
namespace swift {
@@ -39,10 +40,10 @@ bool canUseValue(SILInstruction *User, SILValue Ptr, AliasAnalysis *AA);
/// insertion pts, and decrement insertion pts.
struct ARCMatchingSet {
SILValue Ptr;
llvm::SmallPtrSet<SILInstruction *, 8> Increments;
llvm::SmallPtrSet<SILInstruction *, 8> IncrementInsertPts;
llvm::SmallPtrSet<SILInstruction *, 8> Decrements;
llvm::SmallPtrSet<SILInstruction *, 8> DecrementInsertPts;
llvm::SetVector<SILInstruction *> Increments;
llvm::SetVector<SILInstruction *> IncrementInsertPts;
llvm::SetVector<SILInstruction *> Decrements;
llvm::SetVector<SILInstruction *> DecrementInsertPts;
void clear() {
Ptr = SILValue();