forked from OSchip/llvm-project
parent
ffefea0772
commit
263b0a1669
|
@ -180,9 +180,12 @@ bool IPCP::PropagateConstantReturn(Function &F) {
|
||||||
if (ReplacedAllUsers && F.hasInternalLinkage() && !isa<UndefValue>(RetVal)) {
|
if (ReplacedAllUsers && F.hasInternalLinkage() && !isa<UndefValue>(RetVal)) {
|
||||||
Value *RV = UndefValue::get(RetVal->getType());
|
Value *RV = UndefValue::get(RetVal->getType());
|
||||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||||
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()))
|
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
|
||||||
RI->setOperand(0, RV);
|
if (RI->getOperand(0) != RV) {
|
||||||
MadeChange = true;
|
RI->setOperand(0, RV);
|
||||||
|
MadeChange = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MadeChange) ++NumReturnValProped;
|
if (MadeChange) ++NumReturnValProped;
|
||||||
|
|
Loading…
Reference in New Issue