forked from OSchip/llvm-project
Fix _ExtInt(1) to be a i1 in memory.
The _ExtInt(1) in getTypeForMem was hitting the bool logic for expanding to an 8 bit value. The result was an assert, or store i1 %0, i8* %2, align 1 since the parameter IS an i1. This patch changes the 'forMem' test to exclude ext-int from the bool test.
This commit is contained in:
parent
6780d5675b
commit
2143a90b34
|
@ -93,7 +93,8 @@ llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool ForBitField) {
|
|||
|
||||
// If this is a bool type, or an ExtIntType in a bitfield representation,
|
||||
// map this integer to the target-specified size.
|
||||
if ((ForBitField && T->isExtIntType()) || R->isIntegerTy(1))
|
||||
if ((ForBitField && T->isExtIntType()) ||
|
||||
(!T->isExtIntType() && R->isIntegerTy(1)))
|
||||
return llvm::IntegerType::get(getLLVMContext(),
|
||||
(unsigned)Context.getTypeSize(T));
|
||||
|
||||
|
|
|
@ -45,3 +45,16 @@ void OffsetOfTest() {
|
|||
// LIN32: store i32 2097156, i32* %{{.+}}
|
||||
// WIN32: store i32 2097160, i32* %{{.+}}
|
||||
}
|
||||
|
||||
void Size1ExtIntParam(unsigned _ExtInt(1) A) {
|
||||
// CHECK: define {{.*}}void @Size1ExtIntParam(i1{{.*}} %[[PARAM:.+]])
|
||||
// CHECK: %[[PARAM_ADDR:.+]] = alloca i1
|
||||
// CHECK: %[[B:.+]] = alloca [5 x i1]
|
||||
// CHECK: store i1 %[[PARAM]], i1* %[[PARAM_ADDR]]
|
||||
unsigned _ExtInt(1) B[5];
|
||||
|
||||
// CHECK: %[[PARAM_LOAD:.+]] = load i1, i1* %[[PARAM_ADDR]]
|
||||
// CHECK: %[[IDX:.+]] = getelementptr inbounds [5 x i1], [5 x i1]* %[[B]]
|
||||
// CHECK: store i1 %[[PARAM_LOAD]], i1* %[[IDX]]
|
||||
B[2] = A;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue