Which contains a description of why this is neccesary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2733
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/iTerminators.h"
#include "llvm/Type.h"
#include "llvm/Support/CFG.h"
#include "llvm/iTerminators.h"
#include "llvm/Type.h"
#include "llvm/Support/CFG.h"
+#include "llvm/Constant.h"
#include "llvm/iPHINode.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/iPHINode.h"
#include "llvm/CodeGen/MachineInstr.h"
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
if (max_idx == 2)
PN->replaceAllUsesWith(PN->getOperand(0));
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
if (max_idx == 2)
PN->replaceAllUsesWith(PN->getOperand(0));
- delete getInstList().remove(begin()); // Remove the PHI node
+ else // Otherwise there are no incoming values/edges, replace with dummy
+ PN->replaceAllUsesWith(Constant::getNullValue(PN->getType()));
+ delete getInstList().remove(begin()); // Remove the PHI node
}
} else {
// Okay, now we know that we need to remove predecessor #pred_idx from all
}
} else {
// Okay, now we know that we need to remove predecessor #pred_idx from all