@@ -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}) {
@@ -6475,9 +6469,6 @@ static Value *simplifyIntrinsic(CallBase *Call, Value *Callee,
6475
6469
if (!NumOperands) {
6476
6470
switch (IID) {
6477
6471
case Intrinsic::vscale: {
6478
- // Call may not be inserted into the IR yet at point of calling simplify.
6479
- if (!Call->getParent () || !Call->getParent ()->getParent ())
6480
- return nullptr ;
6481
6472
auto Attr = Call->getFunction ()->getFnAttribute (Attribute::VScaleRange);
6482
6473
if (!Attr.isValid ())
6483
6474
return nullptr ;
@@ -6925,10 +6916,7 @@ static bool replaceAndRecursivelySimplifyImpl(
6925
6916
// Replace the instruction with its simplified value.
6926
6917
I->replaceAllUsesWith (SimpleV);
6927
6918
6928
- // Gracefully handle edge cases where the instruction is not wired into any
6929
- // parent block.
6930
- if (I->getParent () && !I->isEHPad () && !I->isTerminator () &&
6931
- !I->mayHaveSideEffects ())
6919
+ if (!I->isEHPad () && !I->isTerminator () && !I->mayHaveSideEffects ())
6932
6920
I->eraseFromParent ();
6933
6921
} else {
6934
6922
Worklist.insert (I);
@@ -6957,10 +6945,7 @@ static bool replaceAndRecursivelySimplifyImpl(
6957
6945
// Replace the instruction with its simplified value.
6958
6946
I->replaceAllUsesWith (SimpleV);
6959
6947
6960
- // Gracefully handle edge cases where the instruction is not wired into any
6961
- // parent block.
6962
- if (I->getParent () && !I->isEHPad () && !I->isTerminator () &&
6963
- !I->mayHaveSideEffects ())
6948
+ if (!I->isEHPad () && !I->isTerminator () && !I->mayHaveSideEffects ())
6964
6949
I->eraseFromParent ();
6965
6950
}
6966
6951
return Simplified;
0 commit comments