Skip to content

Commit

Permalink
chore: autopublish 2024-06-12T02:14:38Z
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 12, 2024
1 parent 0f29828 commit cca3bbf
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 52 deletions.
4 changes: 2 additions & 2 deletions lib/Analysis/IPA/CallGraphSCCPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/Transforms/IPO/MergeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WeakTrackingVH>::iterator I = Worklist.begin(),
E = Worklist.end(); I != E; ++I) {
E = Worklist.end();
I != E; ++I) {
if (!*I) continue;
Function *F = cast<Function>(*I);
if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage() &&
Expand All @@ -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<WeakTrackingVH>::iterator I = Worklist.begin(),
E = Worklist.end(); I != E; ++I) {
E = Worklist.end();
I != E; ++I) {
if (!*I) continue;
Function *F = cast<Function>(*I);
if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage() &&
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {

static bool isAllocSiteRemovable(Instruction *AI,
SmallVectorImpl<WeakTrackingVH> &Users,
const TargetLibraryInfo *TLI) {
const TargetLibraryInfo *TLI) {
SmallVector<Instruction*, 4> Worklist;
Worklist.push_back(AI);

Expand Down
21 changes: 7 additions & 14 deletions lib/Transforms/Scalar/IndVarSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,20 +903,13 @@ class WidenIV {
SmallVector<NarrowIVDefUse, 8> NarrowIVUsers;

public:
WidenIV(const WideIVInfo &WI, LoopInfo *LInfo,
ScalarEvolution *SEv, DominatorTree *DTree, SmallVectorImpl<WeakTrackingVH> &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<WeakTrackingVH> &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");
}

Expand Down
32 changes: 10 additions & 22 deletions lib/Transforms/Scalar/LoopStrengthReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WeakTrackingVH> &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<WeakTrackingVH> &DeadInsts,
Pass *P) const;
void Rewrite(const LSRFixup &LF,
const Formula &F,
SCEVExpander &Rewriter,
SmallVectorImpl<WeakTrackingVH> &DeadInsts,
Pass *P) const;
SmallVectorImpl<WeakTrackingVH> &DeadInsts, Pass *P) const;
void Rewrite(const LSRFixup &LF, const Formula &F, SCEVExpander &Rewriter,
SmallVectorImpl<WeakTrackingVH> &DeadInsts, Pass *P) const;
void ImplementSolution(const SmallVectorImpl<const Formula *> &Solution,
Pass *P);

Expand Down Expand Up @@ -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<WeakTrackingVH> &DeadInsts) const {
const LSRUse &LU = Uses[LF.LUIdx];
if (LU.RigidFormula)
Expand Down Expand Up @@ -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<WeakTrackingVH> &DeadInsts,
Pass *P) const {
DenseMap<BasicBlock *, Value *> Inserted;
Expand Down Expand Up @@ -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<WeakTrackingVH> &DeadInsts,
Pass *P) const {
Expand Down
8 changes: 4 additions & 4 deletions lib/Transforms/Scalar/LoopUnswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Transforms/Utils/InlineFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions tools/clang/lib/CodeGen/CGDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::pair<llvm::WeakTrackingVH, llvm::Constant *>>
&DtorsAndObjects) {
&DtorsAndObjects) {
{
auto NL = ApplyDebugLocation::CreateEmpty(*this);
StartFunction(GlobalDecl(), getContext().VoidTy, Fn,
Expand Down
7 changes: 4 additions & 3 deletions tools/clang/lib/CodeGen/CodeGenFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2848,9 +2848,10 @@ class CodeGenFunction : public CodeGenTypeCache {

/// GenerateCXXGlobalDtorsFunc - Generates code for destroying global
/// variables.
void GenerateCXXGlobalDtorsFunc(llvm::Function *Fn,
const std::vector<std::pair<llvm::WeakTrackingVH,
llvm::Constant*> > &DtorsAndObjects);
void GenerateCXXGlobalDtorsFunc(
llvm::Function *Fn,
const std::vector<std::pair<llvm::WeakTrackingVH, llvm::Constant *>>
&DtorsAndObjects);

void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
const VarDecl *D,
Expand Down
1 change: 0 additions & 1 deletion unittests/IR/ValueHandleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ TEST_F(ValueHandle, WeakTrackingVH_NullOnDeletion) {
EXPECT_EQ(null_value, WVH_Recreated);
}


TEST_F(ValueHandle, AssertingVH_BasicOperation) {
AssertingVH<CastInst> AVH(BitcastV.get());
CastInst *implicit_to_exact_type = AVH;
Expand Down

0 comments on commit cca3bbf

Please sign in to comment.