mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[mlir][LLVM] Implement mapping of phi source values of llvm.invoke
This patch allows the usage of the normalDestOperands and unwindDestOperands operands of llvm.invoke and have them be correctly mapped to phis in the successor when exported to LLVM IR. Differential Revision: https://reviews.llvm.org/D116706
This commit is contained in:
@@ -386,8 +386,15 @@ static Value getPHISourceValue(Block *current, Block *pred,
|
||||
return switchOp.getCaseOperands(i.index())[index];
|
||||
}
|
||||
|
||||
llvm_unreachable("only branch or switch operations can be terminators of a "
|
||||
"block that has successors");
|
||||
if (auto invokeOp = dyn_cast<LLVM::InvokeOp>(terminator)) {
|
||||
return invokeOp.getNormalDest() == current
|
||||
? invokeOp.getNormalDestOperands()[index]
|
||||
: invokeOp.getUnwindDestOperands()[index];
|
||||
}
|
||||
|
||||
llvm_unreachable(
|
||||
"only branch, switch or invoke operations can be terminators "
|
||||
"of a block that has successors");
|
||||
}
|
||||
|
||||
/// Connect the PHI nodes to the results of preceding blocks.
|
||||
|
||||
Reference in New Issue
Block a user