[llvm-branch-commits] [llvm] 80f8132 - Format and use Small* data structures where appropriate

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 15 04:18:31 PST 2020


Author: gbtozers
Date: 2020-01-15T12:17:41Z
New Revision: 80f81325b8e8f0bed81a28dffb8eba526002f2b3

URL: https://github.com/llvm/llvm-project/commit/80f81325b8e8f0bed81a28dffb8eba526002f2b3
DIFF: https://github.com/llvm/llvm-project/commit/80f81325b8e8f0bed81a28dffb8eba526002f2b3.diff

LOG: Format and use Small* data structures where appropriate

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/DCE.cpp
    llvm/lib/Transforms/Scalar/JumpThreading.cpp
    llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp
index 716b2264eddd..615ca5e31333 100644
--- a/llvm/lib/Transforms/Scalar/DCE.cpp
+++ b/llvm/lib/Transforms/Scalar/DCE.cpp
@@ -135,7 +135,7 @@ struct PureUndefDbgInstElimination : public FunctionPass {
     AU.setPreservesCFG();
   }
 };
-}
+} // namespace
 
 char PureUndefDbgInstElimination::ID = 0;
 INITIALIZE_PASS(PureUndefDbgInstElimination, "pure-undef-dbg-inst-elim",

diff  --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index bc769f01ca21..ce2a14de25da 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -420,12 +420,13 @@ bool JumpThreadingPass::runImpl(Function &F, TargetLibraryInfo *TLI_,
       auto *BI = dyn_cast<BranchInst>(BB.getTerminator());
       if (BI && BI->isUnconditional()) {
         BasicBlock *Succ = BI->getSuccessor(0);
-        if(
+        if (
             // The terminator must be the only non-phi instruction in BB.
             BB.getFirstNonPHIOrDbg()->isTerminator() &&
             // Don't alter Loop headers and latches to ensure another pass can
             // detect and transform nested loops later.
-            !LoopHeaders.count(&BB) && !LoopHeaders.count(BI->getSuccessor(0)) &&
+            !LoopHeaders.count(&BB) &&
+            !LoopHeaders.count(BI->getSuccessor(0)) &&
             TryToSimplifyUncondBranchFromEmptyBlock(&BB, DTU)) {
           // BB is valid for cleanup here because we passed in DTU. F remains
           // BB's parent until a DTU->getDomTree() event.

diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index c9e34c39d830..5bae1e8eb7ef 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -315,37 +315,37 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU,
 }
 
 bool llvm::RemovePureUndefDbgInstrs(Function &F) {
-  DenseMap<DebugVariable, SmallVector<DbgValueInst *, 8> > VariableMap;
-  DenseSet<DebugVariable> NonUndefVariables;
+  SmallDenseMap<DebugVariable, SmallVector<DbgValueInst *, 8>, 8>
+      UndefVariableMap;
+  SmallDenseSet<DebugVariable, 8> NonUndefVariables;
 
   for (auto &BB : F) {
     for (auto &I : BB) {
       if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) {
-        DebugVariable Key(DVI->getVariable(),
-                          DVI->getExpression(),
+        DebugVariable Key(DVI->getVariable(), DVI->getExpression(),
                           DVI->getDebugLoc()->getInlinedAt());
         if (NonUndefVariables.count(Key))
           continue;
         if (DVI->getValue() == UndefValue::get(DVI->getValue()->getType())) {
-          auto R = VariableMap.insert(
-            { Key, SmallVector<DbgValueInst *, 8>(1, DVI) });
+          auto R = UndefVariableMap.insert(
+              {Key, SmallVector<DbgValueInst *, 8>(1, DVI)});
           if (!R.second) {
             auto VMI = R.first;
             VMI->second.push_back(DVI);
           }
         } else {
           NonUndefVariables.insert(Key);
-          VariableMap.erase(Key);
+          UndefVariableMap.erase(Key);
         }
       }
     }
   }
 
-  for (auto VariableMapping : VariableMap)
-    for (auto &Instr : VariableMapping.second)
+  for (auto UndefVariableMapping : UndefVariableMap)
+    for (auto &Instr : UndefVariableMapping.second)
       Instr->eraseFromParent();
 
-  return VariableMap.size() > 0;
+  return UndefVariableMap.size() > 0;
 }
 
 /// Remove redundant instructions within sequences of consecutive dbg.value


        


More information about the llvm-branch-commits mailing list