Backed out changeset 1b62222581fb

Do not use i8 for bool. Instead rely on the target to store i1 as i8.
This commit is contained in:
Christian Kamm
2008-09-21 14:45:41 +02:00
parent 4b02533745
commit bb47b7c4ce
7 changed files with 26 additions and 29 deletions

View File

@@ -81,15 +81,11 @@ void ReturnStatement::toIR(IRState* p)
delete e;
Logger::cout() << "return value is '" <<*v << "'\n";
// can happen for classes
if (v->getType() != p->topfunc()->getReturnType())
{
// can happen for classes
if(isaPointer(v) && isaPointer(p->topfunc()->getReturnType()))
v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp");
// or for i1 vs i8 bools
if(v->getType() == LLType::Int1Ty && p->topfunc()->getReturnType() == LLType::Int8Ty)
v = gIR->ir->CreateZExt(v, LLType::Int8Ty);
Logger::cout() << "adjusted return value: " << *v << '\n';
v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp");
Logger::cout() << "return value after cast: " << *v << '\n';
}
DtoEnclosingHandlers(enclosinghandler, NULL);