@@ -68,11 +68,10 @@ class CloneAddressArithmetic : public FunctionPass {
6868 AU.addRequired <WIAnalysis>();
6969 }
7070
71- typedef llvm::SmallVector<llvm::Instruction *, 16 > RematChain;
72-
73- typedef std::unordered_set<llvm::Instruction *> RematSet;
74- typedef std::pair<RematSet, RematSet> RematPair;
75- typedef llvm::SmallVector<RematPair, 16 > SliceToRematTargetVector;
71+ using RematChain = llvm::SmallVector<llvm::Instruction *, 16 >;
72+ using RematSet = llvm::SmallSetVector<llvm::Instruction *, 16 >;
73+ using RematPair = std::pair<RematSet, RematSet>;
74+ using SliceToRematTargetVector = llvm::SmallVector<RematPair, 16 >;
7675
7776 bool runOnFunction (Function&) override ;
7877
@@ -322,8 +321,11 @@ void CloneAddressArithmetic::addToSystem(RematSet &Set, llvm::Instruction *I) {
322321 }
323322 }
324323
325- if (!Same)
326- Vector.push_back (RematPair (Set, {I}));
324+ if (!Same) {
325+ llvm::SmallSetVector<llvm::Instruction *, 16 > NewSet;
326+ NewSet.insert (I);
327+ Vector.push_back (RematPair (Set, NewSet));
328+ }
327329
328330 PRINT_LOG_NL (" " );
329331}
@@ -462,12 +464,12 @@ void CloneAddressArithmetic::speculateWholeChain(RematSet &ToProcess, unsigned i
462464
463465 addToSetRemat (I, Set);
464466 for (auto & el: Chain) {
465- Set.erase (el);
467+ Set.remove (el);
466468 PRINT_LOG (" [" << FlowMap[el] << " ] " ); PRINT_INST_NL (el);
467469 addToSetRemat (el, Set);
468470 }
469471
470- for (auto el : Set) {
472+ for (auto * el : Set) {
471473 PRINT_LOG (" origin: " ); PRINT_INST (el); PRINT_LOG_NL (" " );
472474 }
473475
0 commit comments