Skip to content

Commit 8752669

Browse files
author
Joe Shajrawi
authored
Merge pull request #9177 from shajrawi/fix_verifier_large_types
Fix an issue that was uncovered by the linux fix: resolves verifier bug in 32-bit code
2 parents 3b333ff + 4fe3a46 commit 8752669

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,11 @@ void LargeValueVisitor::visitApply(ApplySite applySite) {
417417
SILValue currOperand = operand.get();
418418
SILType silType = currOperand->getType();
419419
SILType newSilType = getNewSILType(genEnv, silType, pass.Mod);
420-
if (silType != newSilType) {
420+
if (silType != newSilType ||
421+
std::find(pass.largeLoadableArgs.begin(), pass.largeLoadableArgs.end(),
422+
currOperand) != pass.largeLoadableArgs.end() ||
423+
std::find(pass.funcSigArgs.begin(), pass.funcSigArgs.end(),
424+
currOperand) != pass.funcSigArgs.end()) {
421425
pass.applies.push_back(applySite.getInstruction());
422426
return;
423427
}

lib/SIL/SILVerifier.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,9 +2244,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
22442244

22452245
void checkClassMethodInst(ClassMethodInst *CMI) {
22462246
auto overrideTy = TC.getConstantOverrideType(CMI->getMember());
2247-
requireSameType(CMI->getType(),
2248-
SILType::getPrimitiveObjectType(overrideTy),
2249-
"result type of class_method must match abstracted type of method");
2247+
if (CMI->getModule().getStage() != SILStage::Lowered) {
2248+
requireSameType(
2249+
CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
2250+
"result type of class_method must match abstracted type of method");
2251+
}
22502252
auto methodType = requireObjectType(SILFunctionType, CMI,
22512253
"result of class_method");
22522254
require(!methodType->getExtInfo().hasContext(),
@@ -2280,8 +2282,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
22802282

22812283
void checkSuperMethodInst(SuperMethodInst *CMI) {
22822284
auto overrideTy = TC.getConstantOverrideType(CMI->getMember());
2283-
requireSameType(CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
2284-
"result type of super_method must match abstracted type of method");
2285+
if (CMI->getModule().getStage() != SILStage::Lowered) {
2286+
requireSameType(
2287+
CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
2288+
"result type of super_method must match abstracted type of method");
2289+
}
22852290
auto methodType = requireObjectType(SILFunctionType, CMI,
22862291
"result of super_method");
22872292
require(!methodType->getExtInfo().hasContext(),
@@ -4226,12 +4231,14 @@ void SILVTable::verify(const SILModule &M) const {
42264231
llvm::raw_svector_ostream os(baseName);
42274232
entry.Method.print(os);
42284233
}
4229-
4230-
SILVerifier(*entry.Implementation)
4231-
.requireABICompatibleFunctionTypes(
4232-
baseInfo.getSILType().castTo<SILFunctionType>(),
4233-
entry.Implementation->getLoweredFunctionType(),
4234-
"vtable entry for " + baseName + " must be ABI-compatible");
4234+
4235+
if (M.getStage() != SILStage::Lowered) {
4236+
SILVerifier(*entry.Implementation)
4237+
.requireABICompatibleFunctionTypes(
4238+
baseInfo.getSILType().castTo<SILFunctionType>(),
4239+
entry.Implementation->getLoweredFunctionType(),
4240+
"vtable entry for " + baseName + " must be ABI-compatible");
4241+
}
42354242
}
42364243
#endif
42374244
}

0 commit comments

Comments
 (0)