From cca3bbfdd46a008c1b347485d3f3c86bdae26419 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 12 Jun 2024 02:14:38 +0000 Subject: [PATCH] chore: autopublish 2024-06-12T02:14:38Z --- lib/Analysis/IPA/CallGraphSCCPass.cpp | 4 +-- lib/Transforms/IPO/MergeFunctions.cpp | 6 ++-- .../InstCombine/InstructionCombining.cpp | 2 +- lib/Transforms/Scalar/IndVarSimplify.cpp | 21 ++++-------- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 32 ++++++------------- lib/Transforms/Scalar/LoopUnswitch.cpp | 8 ++--- lib/Transforms/Utils/InlineFunction.cpp | 2 +- tools/clang/lib/CodeGen/CGDeclCXX.cpp | 5 +-- tools/clang/lib/CodeGen/CodeGenFunction.h | 7 ++-- unittests/IR/ValueHandleTest.cpp | 1 - 10 files changed, 36 insertions(+), 52 deletions(-) diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index 610f01a2c7..a9fd9930b5 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -219,7 +219,7 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC, // Get the set of call sites currently in the function. for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ) { // If this call site is null, then the function pass deleted the call - // entirely and the WeakTrackingVH nulled it out. + // entirely and the WeakTrackingVH nulled it out. if (!I->first || // If we've already seen this call site, then the FunctionPass RAUW'd // one call with another, which resulted in two "uses" in the edge @@ -360,7 +360,7 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC, if (NumIndirectRemoved > NumIndirectAdded && NumDirectRemoved < NumDirectAdded) DevirtualizedCall = true; - + // After scanning this function, if we still have entries in callsites, then // they are dangling pointers. WeakTrackingVH should save us for this, so // abort if diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 355165c145..4bdef88966 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/lib/Transforms/IPO/MergeFunctions.cpp @@ -1248,7 +1248,8 @@ bool MergeFunctions::runOnModule(Module &M) { // Insert only strong functions and merge them. Strong function merging // always deletes one of them. for (std::vector::iterator I = Worklist.begin(), - E = Worklist.end(); I != E; ++I) { + E = Worklist.end(); + I != E; ++I) { if (!*I) continue; Function *F = cast(*I); if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage() && @@ -1262,7 +1263,8 @@ bool MergeFunctions::runOnModule(Module &M) { // functions are identical, we create a new strong function with two weak // weak thunks to it which are identical but not mergable. for (std::vector::iterator I = Worklist.begin(), - E = Worklist.end(); I != E; ++I) { + E = Worklist.end(); + I != E; ++I) { if (!*I) continue; Function *F = cast(*I); if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage() && diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index d4e6ed387d..6bc322fa92 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1843,7 +1843,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { static bool isAllocSiteRemovable(Instruction *AI, SmallVectorImpl &Users, - const TargetLibraryInfo *TLI) { + const TargetLibraryInfo *TLI) { SmallVector Worklist; Worklist.push_back(AI); diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 31961b4ddb..d120d465ff 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -903,20 +903,13 @@ class WidenIV { SmallVector NarrowIVUsers; public: - WidenIV(const WideIVInfo &WI, LoopInfo *LInfo, - ScalarEvolution *SEv, DominatorTree *DTree, SmallVectorImpl &DI) - : - OrigPhi(WI.NarrowIV), - WideType(WI.WidestNativeType), - IsSigned(WI.IsSigned), - LI(LInfo), - L(LI->getLoopFor(OrigPhi->getParent())), - SE(SEv), - DT(DTree), - WidePhi(nullptr), - WideInc(nullptr), - WideIncExpr(nullptr), - DeadInsts(DI) { + WidenIV(const WideIVInfo &WI, LoopInfo *LInfo, ScalarEvolution *SEv, + DominatorTree *DTree, SmallVectorImpl &DI) + : OrigPhi(WI.NarrowIV), WideType(WI.WidestNativeType), + IsSigned(WI.IsSigned), LI(LInfo), + L(LI->getLoopFor(OrigPhi->getParent())), SE(SEv), DT(DTree), + WidePhi(nullptr), WideInc(nullptr), WideIncExpr(nullptr), + DeadInsts(DI) { assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV"); } diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index e5c60a432d..3ab9367a6b 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1766,21 +1766,14 @@ class LSRInstance { const LSRUse &LU, SCEVExpander &Rewriter) const; - Value *Expand(const LSRFixup &LF, - const Formula &F, - BasicBlock::iterator IP, + Value *Expand(const LSRFixup &LF, const Formula &F, BasicBlock::iterator IP, SCEVExpander &Rewriter, SmallVectorImpl &DeadInsts) const; - void RewriteForPHI(PHINode *PN, const LSRFixup &LF, - const Formula &F, + void RewriteForPHI(PHINode *PN, const LSRFixup &LF, const Formula &F, SCEVExpander &Rewriter, - SmallVectorImpl &DeadInsts, - Pass *P) const; - void Rewrite(const LSRFixup &LF, - const Formula &F, - SCEVExpander &Rewriter, - SmallVectorImpl &DeadInsts, - Pass *P) const; + SmallVectorImpl &DeadInsts, Pass *P) const; + void Rewrite(const LSRFixup &LF, const Formula &F, SCEVExpander &Rewriter, + SmallVectorImpl &DeadInsts, Pass *P) const; void ImplementSolution(const SmallVectorImpl &Solution, Pass *P); @@ -4449,10 +4442,8 @@ LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator LowestIP, /// Expand - Emit instructions for the leading candidate expression for this /// LSRUse (this is called "expanding"). -Value *LSRInstance::Expand(const LSRFixup &LF, - const Formula &F, - BasicBlock::iterator IP, - SCEVExpander &Rewriter, +Value *LSRInstance::Expand(const LSRFixup &LF, const Formula &F, + BasicBlock::iterator IP, SCEVExpander &Rewriter, SmallVectorImpl &DeadInsts) const { const LSRUse &LU = Uses[LF.LUIdx]; if (LU.RigidFormula) @@ -4634,10 +4625,8 @@ Value *LSRInstance::Expand(const LSRFixup &LF, /// RewriteForPHI - Helper for Rewrite. PHI nodes are special because the use /// of their operands effectively happens in their predecessor blocks, so the /// expression may need to be expanded in multiple places. -void LSRInstance::RewriteForPHI(PHINode *PN, - const LSRFixup &LF, - const Formula &F, - SCEVExpander &Rewriter, +void LSRInstance::RewriteForPHI(PHINode *PN, const LSRFixup &LF, + const Formula &F, SCEVExpander &Rewriter, SmallVectorImpl &DeadInsts, Pass *P) const { DenseMap Inserted; @@ -4710,8 +4699,7 @@ void LSRInstance::RewriteForPHI(PHINode *PN, /// Rewrite - Emit instructions for the leading candidate expression for this /// LSRUse (this is called "expanding"), and update the UserInst to reference /// the newly expanded value. -void LSRInstance::Rewrite(const LSRFixup &LF, - const Formula &F, +void LSRInstance::Rewrite(const LSRFixup &LF, const Formula &F, SCEVExpander &Rewriter, SmallVectorImpl &DeadInsts, Pass *P) const { diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 00a1594e8c..bf2aa49dc0 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -980,10 +980,10 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val, LoopProcessWorklist.push_back(NewLoop); redoLoop = true; - // Keep a WeakTrackingVH holding onto LIC. If the first call to RewriteLoopBody - // deletes the instruction (for example by simplifying a PHI that feeds into - // the condition that we're unswitching on), we don't rewrite the second - // iteration. + // Keep a WeakTrackingVH holding onto LIC. If the first call to + // RewriteLoopBody deletes the instruction (for example by simplifying a PHI + // that feeds into the condition that we're unswitching on), we don't rewrite + // the second iteration. WeakTrackingVH LICHandle(LIC); // Now we rewrite the original code to know that the condition is true and the diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index ff4b29dd56..f6a255a0e4 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -217,7 +217,7 @@ static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, II->setDebugLoc(CI->getDebugLoc()); II->setCallingConv(CI->getCallingConv()); II->setAttributes(CI->getAttributes()); - + // Make sure that anything using the call now uses the invoke! This also // updates the CallGraph if present, because it uses a WeakTrackingVH. CI->replaceAllUsesWith(II); diff --git a/tools/clang/lib/CodeGen/CGDeclCXX.cpp b/tools/clang/lib/CodeGen/CGDeclCXX.cpp index 699c0f7021..1a4b81f6e4 100644 --- a/tools/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/tools/clang/lib/CodeGen/CGDeclCXX.cpp @@ -556,9 +556,10 @@ CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn, FinishFunction(); } -void CodeGenFunction::GenerateCXXGlobalDtorsFunc(llvm::Function *Fn, +void CodeGenFunction::GenerateCXXGlobalDtorsFunc( + llvm::Function *Fn, const std::vector> - &DtorsAndObjects) { + &DtorsAndObjects) { { auto NL = ApplyDebugLocation::CreateEmpty(*this); StartFunction(GlobalDecl(), getContext().VoidTy, Fn, diff --git a/tools/clang/lib/CodeGen/CodeGenFunction.h b/tools/clang/lib/CodeGen/CodeGenFunction.h index 7c7ff628b9..96137c66ee 100644 --- a/tools/clang/lib/CodeGen/CodeGenFunction.h +++ b/tools/clang/lib/CodeGen/CodeGenFunction.h @@ -2848,9 +2848,10 @@ class CodeGenFunction : public CodeGenTypeCache { /// GenerateCXXGlobalDtorsFunc - Generates code for destroying global /// variables. - void GenerateCXXGlobalDtorsFunc(llvm::Function *Fn, - const std::vector > &DtorsAndObjects); + void GenerateCXXGlobalDtorsFunc( + llvm::Function *Fn, + const std::vector> + &DtorsAndObjects); void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn, const VarDecl *D, diff --git a/unittests/IR/ValueHandleTest.cpp b/unittests/IR/ValueHandleTest.cpp index b167b04f94..77daab77a4 100644 --- a/unittests/IR/ValueHandleTest.cpp +++ b/unittests/IR/ValueHandleTest.cpp @@ -100,7 +100,6 @@ TEST_F(ValueHandle, WeakTrackingVH_NullOnDeletion) { EXPECT_EQ(null_value, WVH_Recreated); } - TEST_F(ValueHandle, AssertingVH_BasicOperation) { AssertingVH AVH(BitcastV.get()); CastInst *implicit_to_exact_type = AVH;