[SR-8272] Drop the last remnants of LogicValue

Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
This commit is contained in:
Robert Widmann
2018-12-19 22:05:57 -05:00
parent bf1df4fdf8
commit 426fe886dc
23 changed files with 61 additions and 241 deletions

View File

@@ -687,3 +687,19 @@ Optional<ASTNode> SILGenFunction::getPGOParent(ASTNode Node) const {
return SP->getPGOParent(Node);
return None;
}
SILValue SILGenFunction::emitUnwrapIntegerResult(SILLocation loc,
SILValue value) {
// This is a loop because we want to handle types that wrap integer types,
// like ObjCBool (which may be Bool or Int8).
while (!value->getType().is<BuiltinIntegerType>()) {
auto structDecl = value->getType().getStructOrBoundGenericStruct();
assert(structDecl && "value for error result wasn't of struct type!");
assert(std::next(structDecl->getStoredProperties().begin())
== structDecl->getStoredProperties().end());
auto property = *structDecl->getStoredProperties().begin();
value = B.createStructExtract(loc, value, property);
}
return value;
}