chore: autopublish 2024-06-12T03:17:55Z

This commit is contained in:
github-actions[bot] 2024-06-12 03:17:55 +00:00
Родитель a776a7714f
Коммит d8056f23c6
12 изменённых файлов: 43 добавлений и 57 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -1370,8 +1370,8 @@ bool CodeGenPrepare::OptimizeCallInst(CallInst *CI, bool& ModifiedDT) {
Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL);
// Substituting this can cause recursive simplifications, which can
// invalidate our iterator. Use WeakTrackingVH to hold onto it in case this
// happens.
// invalidate our iterator. Use WeakTrackingVH to hold onto it in case
// this happens.
WeakTrackingVH IterHandle(CurInstIterator);
replaceAndRecursivelySimplify(CI, RetVal,

Просмотреть файл

@ -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() &&
@ -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() &&

Просмотреть файл

@ -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);

Просмотреть файл

@ -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");
}

Просмотреть файл

@ -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);
@ -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)
@ -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;
@ -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 {

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -3195,9 +3195,11 @@ private:
/// \brief Check that the Values in the slice in VL array are still existent in
/// the WeakTrackingVH array.
/// Vectorization of part of the VL array may cause later values in the VL array
/// to become invalid. We track when this has happened in the WeakTrackingVH array.
static bool hasValueBeenRAUWed(ArrayRef<Value *> VL, ArrayRef<WeakTrackingVH> VH,
unsigned SliceBegin, unsigned SliceSize) {
/// to become invalid. We track when this has happened in the WeakTrackingVH
/// array.
static bool hasValueBeenRAUWed(ArrayRef<Value *> VL,
ArrayRef<WeakTrackingVH> VH, unsigned SliceBegin,
unsigned SliceSize) {
VL = VL.slice(SliceBegin, SliceSize);
VH = VH.slice(SliceBegin, SliceSize);
return !std::equal(VL.begin(), VL.end(), VH.begin());

Просмотреть файл

@ -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,

Просмотреть файл

@ -2848,9 +2848,10 @@ public:
/// 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,

Просмотреть файл

@ -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;