mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 02:45:25 +03:00
Zext i1 constants for scalar Boolean struct fields to i8
This commit is contained in:
parent
ab1432ed06
commit
10b0261200
6 changed files with 34 additions and 33 deletions
|
@ -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.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue