forked from OSchip/llvm-project
Make isIsolatedAbove robuster to invalid IR
This function is only called from the verifier. PiperOrigin-RevId: 267145495
This commit is contained in:
parent
8c9dc690eb
commit
636bcbade0
|
@ -143,6 +143,15 @@ static bool isIsolatedAbove(Region ®ion, Region &limit,
|
|||
for (Block &block : *pendingRegions.pop_back_val()) {
|
||||
for (Operation &op : block) {
|
||||
for (Value *operand : op.getOperands()) {
|
||||
// operand should be non-null here if the IR is well-formed. But
|
||||
// we don't assert here as this function is called from the verifier
|
||||
// and so could be called on invalid IR.
|
||||
if (!operand) {
|
||||
if (noteLoc)
|
||||
op.emitOpError("block's operand not defined").attachNote(noteLoc);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that any value that is used by an operation is defined in the
|
||||
// same region as either an operation result or a block argument.
|
||||
if (operand->getParentRegion()->isProperAncestor(&limit)) {
|
||||
|
|
Loading…
Reference in New Issue