[llvm-branch-commits] [llvm] 80f8132 - Format and use Small* data structures where appropriate
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(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 > VariableMap; - DenseSet NonUndefVariables; + SmallDenseMap, 8> + UndefVariableMap; + SmallDenseSet NonUndefVariables; for (auto &BB : F) { for (auto &I : BB) { if (DbgValueInst *DVI = dyn_cast(&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(1, DVI) }); + auto R = UndefVariableMap.insert( + {Key, SmallVector(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 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6762d53 - Add RemovePureUndefs to opt
Author: gbtozers Date: 2020-01-14T15:28:16Z New Revision: 6762d53b66d9de18825f09f43c3d6c2b3ea95913 URL: https://github.com/llvm/llvm-project/commit/6762d53b66d9de18825f09f43c3d6c2b3ea95913 DIFF: https://github.com/llvm/llvm-project/commit/6762d53b66d9de18825f09f43c3d6c2b3ea95913.diff LOG: Add RemovePureUndefs to opt Added: Modified: llvm/include/llvm/InitializePasses.h llvm/include/llvm/LinkAllPasses.h llvm/include/llvm/Transforms/Scalar.h llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h llvm/lib/Transforms/Scalar/DCE.cpp llvm/lib/Transforms/Scalar/JumpThreading.cpp llvm/lib/Transforms/Scalar/Scalar.cpp llvm/lib/Transforms/Utils/BasicBlockUtils.cpp Removed: diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index 831c6882b4a9..c59170da05a0 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -347,6 +347,7 @@ void initializeRAGreedyPass(PassRegistry&); void initializeReachingDefAnalysisPass(PassRegistry&); void initializeReassociateLegacyPassPass(PassRegistry&); void initializeRedundantDbgInstEliminationPass(PassRegistry&); +void initializePureUndefDbgInstEliminationPass(PassRegistry&); void initializeRegAllocFastPass(PassRegistry&); void initializeRegBankSelectPass(PassRegistry&); void initializeRegToMemPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h index aa64296f9428..9dcf5958029e 100644 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -160,6 +160,7 @@ namespace { (void) llvm::createPostDomViewerPass(); (void) llvm::createReassociatePass(); (void) llvm::createRedundantDbgInstEliminationPass(); + (void) llvm::createPureUndefDbgInstEliminationPass(); (void) llvm::createRegionInfoPass(); (void) llvm::createRegionOnlyPrinterPass(); (void) llvm::createRegionOnlyViewerPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h index 1f2842836303..85c931bb20d1 100644 --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -60,6 +60,14 @@ Pass *createDeadInstEliminationPass(); // Pass *createRedundantDbgInstEliminationPass(); +//===--===// +// +// PureUndefDbgInstElimination - This pass removes dbg intrinsics for variables +// which are always `undef` within a function, without modifying the CFG of the +// function. It is a FunctionPass. +// +Pass *createPureUndefDbgInstEliminationPass(); + //===--===// // // DeadCodeElimination - This pass is more powerful than DeadInstElimination, diff --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h index dec8447c9f52..2273d7d90a41 100644 --- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -98,6 +98,8 @@ bool MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU = nullptr, /// Returns true if at least one instruction was removed. bool RemoveRedundantDbgInstrs(BasicBlock *BB); +bool RemovePureUndefDbgInstrs(Function &F); + /// Replace all uses of an instruction (specified by BI) with a value, then /// remove and delete the original instruction. void ReplaceInstWithValue(BasicBlock::InstListType &BIL, diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index a4b0c8df98f6..716b2264eddd 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -115,6 +115,36 @@ Pass *llvm::createRedundantDbgInstEliminationPass() { return new RedundantDbgInstElimination(); } +//======// +// PureUndefDbgInstElimination pass implementation +// + +namespace { +struct PureUndefDbgInstElimination : public FunctionPass { + static char ID; // Pass identification, replacement for typeid + PureUndefDbgInstElimination() : FunctionPass(ID) { + initializePureUndefDbgInstEliminationPass(*PassRegistry::getPassRegistry()); + } + bool runOnFunction(Function &F) override { +if (skipFunction(F)) + return false; +return RemovePureUndefDbgInstrs(F); + } + + void getAnalysisUsage(AnalysisUsage &AU) const override { +AU.setPreservesCFG(); + } +}; +} + +char PureUndefDbgInstElimination::ID = 0; +INITIALIZE_PASS(PureUndefDbgInstElimination, "pure-undef-dbg-inst-elim", +"Pure Undef Dbg Instruction Elimination", false, false) + +Pass *llvm::createPureUndefDbgInstEliminationPass() { + return new PureUndefDbgInstElimination(); +} + //======
[llvm-branch-commits] [llvm] 0b5157d - First commit on the branch
Author: Hans Wennborg Date: 2020-01-15T13:42:06+01:00 New Revision: 0b5157db53a3bd1988d27820491bbf02cd1a1278 URL: https://github.com/llvm/llvm-project/commit/0b5157db53a3bd1988d27820491bbf02cd1a1278 DIFF: https://github.com/llvm/llvm-project/commit/0b5157db53a3bd1988d27820491bbf02cd1a1278.diff LOG: First commit on the branch Added: Modified: llvm/docs/ReleaseNotes.rst Removed: diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 96331a76f266..be9b704d9bf3 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -111,6 +111,8 @@ Changes to the LLVM IR Changes to building LLVM +... + Changes to the ARM Backend -- ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 24b8143 - Add tests, code style fixes
Author: gbtozers Date: 2020-01-15T15:30:13Z New Revision: 24b81434a056825f4e9dd3ef06bad7a2ef34f813 URL: https://github.com/llvm/llvm-project/commit/24b81434a056825f4e9dd3ef06bad7a2ef34f813 DIFF: https://github.com/llvm/llvm-project/commit/24b81434a056825f4e9dd3ef06bad7a2ef34f813.diff LOG: Add tests, code style fixes Added: llvm/test/Transforms/DCE/pure-undef-dbg-inst-elim.ll Modified: llvm/include/llvm/InitializePasses.h llvm/include/llvm/LinkAllPasses.h llvm/include/llvm/Transforms/Scalar.h llvm/lib/Transforms/Scalar/DCE.cpp llvm/lib/Transforms/Scalar/Scalar.cpp Removed: diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h index c59170da05a0..647b3a34722c 100644 --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -342,12 +342,12 @@ void initializeProcessImplicitDefsPass(PassRegistry&); void initializeProfileSummaryInfoWrapperPassPass(PassRegistry&); void initializePromoteLegacyPassPass(PassRegistry&); void initializePruneEHPass(PassRegistry&); +void initializePureUndefDbgInstEliminationPass(PassRegistry&); void initializeRABasicPass(PassRegistry&); void initializeRAGreedyPass(PassRegistry&); void initializeReachingDefAnalysisPass(PassRegistry&); void initializeReassociateLegacyPassPass(PassRegistry&); void initializeRedundantDbgInstEliminationPass(PassRegistry&); -void initializePureUndefDbgInstEliminationPass(PassRegistry&); void initializeRegAllocFastPass(PassRegistry&); void initializeRegBankSelectPass(PassRegistry&); void initializeRegToMemPass(PassRegistry&); diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h index 9dcf5958029e..962329219b0b 100644 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -158,9 +158,9 @@ namespace { (void) llvm::createPostDomPrinterPass(); (void) llvm::createPostDomOnlyViewerPass(); (void) llvm::createPostDomViewerPass(); + (void) llvm::createPureUndefDbgInstEliminationPass(); (void) llvm::createReassociatePass(); (void) llvm::createRedundantDbgInstEliminationPass(); - (void) llvm::createPureUndefDbgInstEliminationPass(); (void) llvm::createRegionInfoPass(); (void) llvm::createRegionOnlyPrinterPass(); (void) llvm::createRegionOnlyViewerPass(); diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h index 85c931bb20d1..0b4f605ac95f 100644 --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -55,18 +55,18 @@ Pass *createDeadInstEliminationPass(); //===--===// // -// RedundantDbgInstElimination - This pass removes redundant dbg intrinsics -// without modifying the CFG of the function. It is a FunctionPass. +// PureUndefDbgInstElimination - This pass removes dbg intrinsics for variables +// that are always `undef` within a function, without modifying the CFG of the +// function. It is a FunctionPass. // -Pass *createRedundantDbgInstEliminationPass(); +Pass *createPureUndefDbgInstEliminationPass(); //===--===// // -// PureUndefDbgInstElimination - This pass removes dbg intrinsics for variables -// which are always `undef` within a function, without modifying the CFG of the -// function. It is a FunctionPass. +// RedundantDbgInstElimination - This pass removes redundant dbg intrinsics +// without modifying the CFG of the function. It is a FunctionPass. // -Pass *createPureUndefDbgInstEliminationPass(); +Pass *createRedundantDbgInstEliminationPass(); //===--===// // diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index 615ca5e31333..e7afdf26e699 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -121,7 +121,7 @@ Pass *llvm::createRedundantDbgInstEliminationPass() { namespace { struct PureUndefDbgInstElimination : public FunctionPass { - static char ID; // Pass identification, replacement for typeid + static char ID; // Pass identification, replacement for typeid. PureUndefDbgInstElimination() : FunctionPass(ID) { initializePureUndefDbgInstEliminationPass(*PassRegistry::getPassRegistry()); } diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp index b0d38ab82874..23e049625254 100644 --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -89,9 +89,9 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { initializeMergedLoadStoreMotionLegacyPassPass(Registry); initializeNaryReassociateLegacyPassPass(Registry); initializePartiallyInlineLibCallsLegacyPassPass(Registr
[llvm-branch-commits] [llvm] 3191fa2 - Use isa where needed
Author: gbtozers Date: 2020-01-15T15:51:22Z New Revision: 3191fa21be09d6e7352751f86626a2e8fb251555 URL: https://github.com/llvm/llvm-project/commit/3191fa21be09d6e7352751f86626a2e8fb251555 DIFF: https://github.com/llvm/llvm-project/commit/3191fa21be09d6e7352751f86626a2e8fb251555.diff LOG: Use isa where needed Added: Modified: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp Removed: diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 5bae1e8eb7ef..9d703d2ab7db 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -326,7 +326,7 @@ bool llvm::RemovePureUndefDbgInstrs(Function &F) { DVI->getDebugLoc()->getInlinedAt()); if (NonUndefVariables.count(Key)) continue; -if (DVI->getValue() == UndefValue::get(DVI->getValue()->getType())) { +if (isa(DVI->getValue())) { auto R = UndefVariableMap.insert( {Key, SmallVector(1, DVI)}); if (!R.second) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits