mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: add a failure message operand to Builtin.condfail
The SIL generation for this builtin also changes: instead of generating the cond_fail instructions upfront, let the optimizer generate it, if the operand is a static string literal. In worst case, if the second operand is not a static string literal, the Builtin.condfail is lowered at the end of the optimization pipeline with a default message: "unknown program error".
This commit is contained in:
@@ -454,6 +454,19 @@ SILValue InstSimplifier::visitBeginAccessInst(BeginAccessInst *BAI) {
|
||||
}
|
||||
|
||||
static SILValue simplifyBuiltin(BuiltinInst *BI) {
|
||||
|
||||
switch (BI->getBuiltinInfo().ID) {
|
||||
case BuiltinValueKind::IntToPtr:
|
||||
if (auto *OpBI = dyn_cast<BuiltinInst>(BI->getOperand(0))) {
|
||||
if (OpBI->getBuiltinInfo().ID == BuiltinValueKind::PtrToInt) {
|
||||
return OpBI->getOperand(0);
|
||||
}
|
||||
}
|
||||
return SILValue();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const IntrinsicInfo &Intrinsic = BI->getIntrinsicInfo();
|
||||
|
||||
switch (Intrinsic.ID) {
|
||||
|
||||
Reference in New Issue
Block a user