@@ -218,12 +218,6 @@ static bool valueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
218
218
// Arguments and constants dominate all instructions.
219
219
return true ;
220
220
221
- // If we are processing instructions (and/or basic blocks) that have not been
222
- // fully added to a function, the parent nodes may still be null. Simply
223
- // return the conservative answer in these cases.
224
- if (!I->getParent () || !P->getParent () || !I->getFunction ())
225
- return false ;
226
-
227
221
// If we have a DominatorTree then do a precise test.
228
222
if (DT)
229
223
return DT->dominates (I, P);
@@ -2638,7 +2632,7 @@ static bool isAllocDisjoint(const Value *V) {
2638
2632
// that might be resolve lazily to symbols in another dynamically-loaded
2639
2633
// library (and, thus, could be malloc'ed by the implementation).
2640
2634
if (const AllocaInst *AI = dyn_cast<AllocaInst>(V))
2641
- return AI->getParent () && AI-> getFunction () && AI-> isStaticAlloca ();
2635
+ return AI->isStaticAlloca ();
2642
2636
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
2643
2637
return (GV->hasLocalLinkage () || GV->hasHiddenVisibility () ||
2644
2638
GV->hasProtectedVisibility () || GV->hasGlobalUnnamedAddr ()) &&
@@ -3669,7 +3663,7 @@ static Value *simplifyICmpWithDominatingAssume(CmpInst::Predicate Predicate,
3669
3663
Value *LHS, Value *RHS,
3670
3664
const SimplifyQuery &Q) {
3671
3665
// Gracefully handle instructions that have not been inserted yet.
3672
- if (!Q.AC || !Q.CxtI || !Q. CxtI -> getParent () )
3666
+ if (!Q.AC || !Q.CxtI )
3673
3667
return nullptr ;
3674
3668
3675
3669
for (Value *AssumeBaseOp : {LHS, RHS}) {
@@ -6474,9 +6468,6 @@ static Value *simplifyIntrinsic(CallBase *Call, Value *Callee,
6474
6468
if (!NumOperands) {
6475
6469
switch (IID) {
6476
6470
case Intrinsic::vscale: {
6477
- // Call may not be inserted into the IR yet at point of calling simplify.
6478
- if (!Call->getParent () || !Call->getParent ()->getParent ())
6479
- return nullptr ;
6480
6471
auto Attr = Call->getFunction ()->getFnAttribute (Attribute::VScaleRange);
6481
6472
if (!Attr.isValid ())
6482
6473
return nullptr ;
@@ -6924,10 +6915,7 @@ static bool replaceAndRecursivelySimplifyImpl(
6924
6915
// Replace the instruction with its simplified value.
6925
6916
I->replaceAllUsesWith (SimpleV);
6926
6917
6927
- // Gracefully handle edge cases where the instruction is not wired into any
6928
- // parent block.
6929
- if (I->getParent () && !I->isEHPad () && !I->isTerminator () &&
6930
- !I->mayHaveSideEffects ())
6918
+ if (!I->isEHPad () && !I->isTerminator () && !I->mayHaveSideEffects ())
6931
6919
I->eraseFromParent ();
6932
6920
} else {
6933
6921
Worklist.insert (I);
@@ -6956,10 +6944,7 @@ static bool replaceAndRecursivelySimplifyImpl(
6956
6944
// Replace the instruction with its simplified value.
6957
6945
I->replaceAllUsesWith (SimpleV);
6958
6946
6959
- // Gracefully handle edge cases where the instruction is not wired into any
6960
- // parent block.
6961
- if (I->getParent () && !I->isEHPad () && !I->isTerminator () &&
6962
- !I->mayHaveSideEffects ())
6947
+ if (!I->isEHPad () && !I->isTerminator () && !I->mayHaveSideEffects ())
6963
6948
I->eraseFromParent ();
6964
6949
}
6965
6950
return Simplified;
0 commit comments