@@ -90,7 +90,7 @@ static bool isSameCompare(Value *V, CmpInst::Predicate Pred, Value *LHS,
90
90
}
91
91
92
92
// / Does the given value dominate the specified phi node?
93
- static bool ValueDominatesPHI (Value *V, PHINode *P, const DominatorTree *DT) {
93
+ static bool valueDominatesPHI (Value *V, PHINode *P, const DominatorTree *DT) {
94
94
Instruction *I = dyn_cast<Instruction>(V);
95
95
if (!I)
96
96
// Arguments and constants dominate all instructions.
@@ -99,7 +99,7 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
99
99
// If we are processing instructions (and/or basic blocks) that have not been
100
100
// fully added to a function, the parent nodes may still be null. Simply
101
101
// return the conservative answer in these cases.
102
- if (!I->getParent () || !P->getParent () || !I->getParent ()-> getParent ())
102
+ if (!I->getParent () || !P->getParent () || !I->getFunction ())
103
103
return false ;
104
104
105
105
// If we have a DominatorTree then do a precise test.
@@ -108,7 +108,7 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
108
108
109
109
// Otherwise, if the instruction is in the entry block and is not an invoke,
110
110
// then it obviously dominates all phi nodes.
111
- if (I->getParent () == &I->getParent ()-> getParent ()->getEntryBlock () &&
111
+ if (I->getParent () == &I->getFunction ()->getEntryBlock () &&
112
112
!isa<InvokeInst>(I))
113
113
return true ;
114
114
@@ -443,13 +443,13 @@ static Value *ThreadBinOpOverPHI(Instruction::BinaryOps Opcode, Value *LHS,
443
443
if (isa<PHINode>(LHS)) {
444
444
PI = cast<PHINode>(LHS);
445
445
// Bail out if RHS and the phi may be mutually interdependent due to a loop.
446
- if (!ValueDominatesPHI (RHS, PI, Q.DT ))
446
+ if (!valueDominatesPHI (RHS, PI, Q.DT ))
447
447
return nullptr ;
448
448
} else {
449
449
assert (isa<PHINode>(RHS) && " No PHI instruction operand!" );
450
450
PI = cast<PHINode>(RHS);
451
451
// Bail out if LHS and the phi may be mutually interdependent due to a loop.
452
- if (!ValueDominatesPHI (LHS, PI, Q.DT ))
452
+ if (!valueDominatesPHI (LHS, PI, Q.DT ))
453
453
return nullptr ;
454
454
}
455
455
@@ -490,7 +490,7 @@ static Value *ThreadCmpOverPHI(CmpInst::Predicate Pred, Value *LHS, Value *RHS,
490
490
PHINode *PI = cast<PHINode>(LHS);
491
491
492
492
// Bail out if RHS and the phi may be mutually interdependent due to a loop.
493
- if (!ValueDominatesPHI (RHS, PI, Q.DT ))
493
+ if (!valueDominatesPHI (RHS, PI, Q.DT ))
494
494
return nullptr ;
495
495
496
496
// Evaluate the BinOp on the incoming phi values.
@@ -3986,7 +3986,7 @@ static Value *SimplifyPHINode(PHINode *PN, const SimplifyQuery &Q) {
3986
3986
// instruction, we cannot return X as the result of the PHI node unless it
3987
3987
// dominates the PHI block.
3988
3988
if (HasUndefInput)
3989
- return ValueDominatesPHI (CommonValue, PN, Q.DT ) ? CommonValue : nullptr ;
3989
+ return valueDominatesPHI (CommonValue, PN, Q.DT ) ? CommonValue : nullptr ;
3990
3990
3991
3991
return CommonValue;
3992
3992
}
0 commit comments