Zext i1 constants for scalar Boolean struct fields to i8

This commit is contained in:
Martin 2016-10-23 15:14:52 +02:00
parent ab1432ed06
commit 10b0261200
6 changed files with 34 additions and 33 deletions

View file

@ -1120,18 +1120,15 @@ LLConstant *DtoConstExpInit(Loc &loc, Type *targetType, Expression *exp) {
if (val->isNullValue())
return llvm::Constant::getNullValue(targetLLType);
if (llType == targetLLType)
return val;
// extend i1 to i8
if (llType == LLType::getInt1Ty(gIR->context())) {
llType = LLType::getInt8Ty(gIR->context());
val = llvm::ConstantExpr::getZExt(val, llType);
if (llType == targetLLType)
return val;
}
if (llType == targetLLType)
return val;
if (baseTargetType->ty == Tsarray) {
Logger::println("Building constant array initializer from scalar.");