forked from OSchip/llvm-project
[clang][CodeGen]Fix clang crash and add bitfield support in __builtin_dump_struct
Fix clang crash and add bitfield support in __builtin_dump_struct. In clang13.0.x, a struct with three or more members and a bitfield at the same time will cause a crash. In clang15.x, as long as the struct has one bitfield, it will cause a crash in clang. Open issue: https://github.com/llvm/llvm-project/issues/54462 Differential Revision: https://reviews.llvm.org/D122248
This commit is contained in:
parent
d41445113b
commit
7faa95624e
|
@ -79,7 +79,6 @@ Bug Fixes
|
|||
function with the ``naked`` attribute. This fixes
|
||||
`Issue 50541 <https://github.com/llvm/llvm-project/issues/50541>`_.
|
||||
|
||||
|
||||
Improvements to Clang's diagnostics
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- ``-Wliteral-range`` will warn on floating-point equality comparisons with
|
||||
|
@ -92,6 +91,10 @@ Improvements to Clang's diagnostics
|
|||
<https://github.com/llvm/llvm-project/issues/50794>`_.
|
||||
|
||||
Non-comprehensive list of changes in this release
|
||||
- The builtin function __builtin_dump_struct would crash clang when the target
|
||||
struct have bitfield. Now it fixed, and __builtin_dump_struct support dump
|
||||
the bitwidth of bitfields.
|
||||
This fixes `Issue 54462 <https://github.com/llvm/llvm-project/issues/54462>`_.
|
||||
-------------------------------------------------
|
||||
|
||||
New Compiler Flags
|
||||
|
@ -134,6 +137,12 @@ Attribute Changes in Clang
|
|||
- The ``__declspec(naked)`` attribute can no longer be written on a member
|
||||
function in Microsoft compatibility mode, matching the behavior of cl.exe.
|
||||
|
||||
- Improve __builtin_dump_struct:
|
||||
|
||||
- Support bitfields in struct and union.
|
||||
|
||||
- Improve the dump format, dump both bitwidth(if its a bitfield) and field value.
|
||||
|
||||
Windows Support
|
||||
---------------
|
||||
|
||||
|
|
|
@ -2044,7 +2044,7 @@ EmitCheckedMixedSignMultiply(CodeGenFunction &CGF, const clang::Expr *Op1,
|
|||
}
|
||||
|
||||
static llvm::Value *dumpRecord(CodeGenFunction &CGF, QualType RType,
|
||||
Value *&RecordPtr, CharUnits Align,
|
||||
LValue RecordLV, CharUnits Align,
|
||||
llvm::FunctionCallee Func, int Lvl) {
|
||||
ASTContext &Context = CGF.getContext();
|
||||
RecordDecl *RD = RType->castAs<RecordType>()->getDecl()->getDefinition();
|
||||
|
@ -2077,47 +2077,60 @@ static llvm::Value *dumpRecord(CodeGenFunction &CGF, QualType RType,
|
|||
}
|
||||
|
||||
for (const auto *FD : RD->fields()) {
|
||||
Value *FieldPtr = RecordPtr;
|
||||
if (RD->isUnion())
|
||||
FieldPtr = CGF.Builder.CreatePointerCast(
|
||||
FieldPtr, CGF.ConvertType(Context.getPointerType(FD->getType())));
|
||||
else
|
||||
FieldPtr = CGF.Builder.CreateStructGEP(CGF.ConvertType(RType), FieldPtr,
|
||||
FD->getFieldIndex());
|
||||
Value *TmpRes = nullptr;
|
||||
|
||||
GString = CGF.Builder.CreateGlobalStringPtr(
|
||||
llvm::Twine(Pad)
|
||||
std::string Format = llvm::Twine(Pad)
|
||||
.concat(FD->getType().getAsString())
|
||||
.concat(llvm::Twine(' '))
|
||||
.concat(FD->getNameAsString())
|
||||
.concat(" : ")
|
||||
.str());
|
||||
Value *TmpRes = CGF.Builder.CreateCall(Func, {GString});
|
||||
Res = CGF.Builder.CreateAdd(Res, TmpRes);
|
||||
.str();
|
||||
|
||||
if (FD->isBitField()) {
|
||||
unsigned BitfieldWidth = FD->getBitWidthValue(CGF.getContext());
|
||||
|
||||
// If current field is a unnamed bitfield, we should dump only one ' '
|
||||
// between type-name and ':'
|
||||
if (!FD->getDeclName().isEmpty())
|
||||
Format += ' ';
|
||||
Format += llvm::Twine(": ").concat(llvm::Twine(BitfieldWidth)).str();
|
||||
|
||||
// If current field is a zero-width bitfield, we just dump a string like
|
||||
// 'type-name : 0'
|
||||
if (FD->isZeroSize(CGF.getContext())) {
|
||||
Format += "\n";
|
||||
GString = CGF.Builder.CreateGlobalStringPtr(Format);
|
||||
TmpRes = CGF.Builder.CreateCall(Func, {GString});
|
||||
Res = CGF.Builder.CreateAdd(Res, TmpRes);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
LValue FieldLV = CGF.EmitLValueForField(RecordLV, FD);
|
||||
QualType CanonicalType =
|
||||
FD->getType().getUnqualifiedType().getCanonicalType();
|
||||
|
||||
// We check whether we are in a recursive type
|
||||
if (CanonicalType->isRecordType()) {
|
||||
TmpRes = dumpRecord(CGF, CanonicalType, FieldPtr, Align, Func, Lvl + 1);
|
||||
TmpRes = dumpRecord(CGF, CanonicalType, FieldLV, Align, Func, Lvl + 1);
|
||||
Res = CGF.Builder.CreateAdd(TmpRes, Res);
|
||||
continue;
|
||||
}
|
||||
|
||||
// We try to determine the best format to print the current field
|
||||
llvm::Twine Format = Types.find(CanonicalType) == Types.end()
|
||||
const char *TypeFormat = Types.find(CanonicalType) == Types.end()
|
||||
? Types[Context.VoidPtrTy]
|
||||
: Types[CanonicalType];
|
||||
|
||||
Address FieldAddress =
|
||||
Address(FieldPtr, CGF.ConvertTypeForMem(FD->getType()), Align);
|
||||
FieldPtr = CGF.Builder.CreateLoad(FieldAddress);
|
||||
GString = CGF.Builder.CreateGlobalStringPtr(llvm::Twine(Format)
|
||||
.concat(" = ")
|
||||
.concat(TypeFormat)
|
||||
.concat(llvm::Twine('\n'))
|
||||
.str());
|
||||
|
||||
// FIXME Need to handle bitfield here
|
||||
GString = CGF.Builder.CreateGlobalStringPtr(
|
||||
Format.concat(llvm::Twine('\n')).str());
|
||||
TmpRes = CGF.Builder.CreateCall(Func, {GString, FieldPtr});
|
||||
RValue RV = FD->isBitField()
|
||||
? CGF.EmitLoadOfBitfieldLValue(FieldLV, FD->getLocation())
|
||||
: CGF.EmitLoadOfLValue(FieldLV, FD->getLocation());
|
||||
TmpRes = CGF.Builder.CreateCall(Func, {GString, RV.getScalarVal()});
|
||||
Res = CGF.Builder.CreateAdd(Res, TmpRes);
|
||||
}
|
||||
|
||||
|
@ -2664,7 +2677,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
|
|||
QualType Arg0Type = Arg0->getType()->getPointeeType();
|
||||
|
||||
Value *RecordPtr = EmitScalarExpr(Arg0);
|
||||
Value *Res = dumpRecord(*this, Arg0Type, RecordPtr, Arg0Align,
|
||||
LValue RecordLV = MakeAddrLValue(RecordPtr, Arg0Type, Arg0Align);
|
||||
Value *Res = dumpRecord(*this, Arg0Type, RecordLV, Arg0Align,
|
||||
{LLVMFuncType, Func}, 0);
|
||||
return RValue::get(Res);
|
||||
}
|
||||
|
|
|
@ -4,114 +4,95 @@
|
|||
#include <stdint.h>
|
||||
|
||||
// CHECK: @__const.unit1.a = private unnamed_addr constant %struct.U1A { i16 12 }, align 2
|
||||
// CHECK-NEXT: [[STRUCT_STR_U1:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U1A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U1:@[0-9]+]] = private unnamed_addr constant [11 x i8] c"short a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U1:@[0-9]+]] = private unnamed_addr constant [5 x i8] c"%hd\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U1:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U1:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U1A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U1:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"short a = %hd\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U1:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit2.a = private unnamed_addr constant %struct.U2A { i16 12 }, align 2
|
||||
// CHECK-NEXT: [[STRUCT_STR_U2:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U2A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U2:@[0-9]+]] = private unnamed_addr constant [20 x i8] c"unsigned short a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U2:@[0-9]+]] = private unnamed_addr constant [5 x i8] c"%hu\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U2:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U2:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U2A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U2:@[0-9]+]] = private unnamed_addr constant [24 x i8] c"unsigned short a = %hu\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U2:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit3.a = private unnamed_addr constant %struct.U3A { i32 12 }, align 4
|
||||
// CHECK-NEXT: [[STRUCT_STR_U3:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U3A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U3:@[0-9]+]] = private unnamed_addr constant [9 x i8] c"int a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U3:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%d\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U3:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U3:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U3A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U3:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"int a = %d\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U3:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit4.a = private unnamed_addr constant %struct.U4A { i32 12 }, align 4
|
||||
// CHECK-NEXT: [[STRUCT_STR_U4:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U4A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U4:@[0-9]+]] = private unnamed_addr constant [18 x i8] c"unsigned int a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U4:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%u\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U4:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U4:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U4A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U4:@[0-9]+]] = private unnamed_addr constant [21 x i8] c"unsigned int a = %u\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U4:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit5.a = private unnamed_addr constant %struct.U5A { i64 12 }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U5:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U5A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U5:@[0-9]+]] = private unnamed_addr constant [10 x i8] c"long a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U5:@[0-9]+]] = private unnamed_addr constant [5 x i8] c"%ld\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U5:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U5:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U5A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U5:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"long a = %ld\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U5:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit6.a = private unnamed_addr constant %struct.U6A { i64 12 }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U6:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U6A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U6:@[0-9]+]] = private unnamed_addr constant [19 x i8] c"unsigned long a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U6:@[0-9]+]] = private unnamed_addr constant [5 x i8] c"%lu\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U6:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U6:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U6A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U6:@[0-9]+]] = private unnamed_addr constant [23 x i8] c"unsigned long a = %lu\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U6:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit7.a = private unnamed_addr constant %struct.U7A { i64 12 }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U7:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U7A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U7:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"long long a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U7:@[0-9]+]] = private unnamed_addr constant [6 x i8] c"%lld\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U7:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U7:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U7A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U7:@[0-9]+]] = private unnamed_addr constant [20 x i8] c"long long a = %lld\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U7:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit8.a = private unnamed_addr constant %struct.U8A { i64 12 }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U8:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U8A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U8:@[0-9]+]] = private unnamed_addr constant [24 x i8] c"unsigned long long a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U8:@[0-9]+]] = private unnamed_addr constant [6 x i8] c"%llu\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U8:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U8:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U8A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U8:@[0-9]+]] = private unnamed_addr constant [29 x i8] c"unsigned long long a = %llu\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U8:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit9.a = private unnamed_addr constant %struct.U9A { i8 97 }, align 1
|
||||
// CHECK-NEXT: [[STRUCT_STR_U9:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U9A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U9:@[0-9]+]] = private unnamed_addr constant [10 x i8] c"char a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U9:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%c\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U9:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U9:@[0-9]+]] = private unnamed_addr constant [14 x i8] c"struct U9A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U9:@[0-9]+]] = private unnamed_addr constant [13 x i8] c"char a = %c\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U9:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @.str = private unnamed_addr constant [4 x i8] c"LSE\00", align 1
|
||||
|
||||
// CHECK: @__const.unit10.a = private unnamed_addr constant %struct.U10A { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0) }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U10:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U10A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U10:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"char * a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U10:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%s\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U10:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U10:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U10A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U10:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"char * a = %s\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U10:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit11.a = private unnamed_addr constant %struct.U11A { i8* inttoptr (i64 305419896 to i8*) }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U11:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U11A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U11:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"void * a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U11:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%p\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U11:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U11:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U11A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U11:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"void * a = %p\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U11:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit12.a = private unnamed_addr constant %struct.U12A { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0) }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U12:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U12A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U12:@[0-9]+]] = private unnamed_addr constant [18 x i8] c"const char * a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U12:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%s\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U12:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U12:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U12A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U12:@[0-9]+]] = private unnamed_addr constant [21 x i8] c"const char * a = %s\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U12:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit13.a = private unnamed_addr constant %struct.U13A { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0) }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U13:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U13A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U13:@[0-9]+]] = private unnamed_addr constant [20 x i8] c"const charstar a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U13:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%s\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U13:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U13:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U13A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U13:@[0-9]+]] = private unnamed_addr constant [23 x i8] c"const charstar a = %s\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U13:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit14.a = private unnamed_addr constant %struct.U14A { double 0x3FF1F9ACFFA7EB6C }, align 8
|
||||
// CHECK-NEXT: [[STRUCT_STR_U14:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U14A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U14:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"double a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U14:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%f\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U14:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U14:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U14A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U14:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"double a = %f\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U14:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit15.a = private unnamed_addr constant %struct.U15A { [3 x i32] [i32 1, i32 2, i32 3] }, align 4
|
||||
// CHECK-NEXT: [[STRUCT_STR_U15:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U15A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U15:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"int[3] a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U15:@[0-9]+]] = private unnamed_addr constant [4 x i8] c"%p\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U15:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U15:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U15A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U15:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"int[3] a = %p\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U15:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit16.a = private unnamed_addr constant %struct.U16A { i8 12 }, align 1
|
||||
// CHECK-NEXT: [[STRUCT_STR_U16:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U16A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U16:@[0-9]+]] = private unnamed_addr constant [13 x i8] c"uint8_t a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U16:@[0-9]+]] = private unnamed_addr constant [6 x i8] c"%hhu\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U16:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U16:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U16A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U16:@[0-9]+]] = private unnamed_addr constant [18 x i8] c"uint8_t a = %hhu\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U16:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit17.a = private unnamed_addr constant %struct.U17A { i8 12 }, align 1
|
||||
// CHECK-NEXT: [[STRUCT_STR_U17:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U17A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U17:@[0-9]+]] = private unnamed_addr constant [12 x i8] c"int8_t a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U17:@[0-9]+]] = private unnamed_addr constant [6 x i8] c"%hhd\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U17:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U17:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U17A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U17:@[0-9]+]] = private unnamed_addr constant [17 x i8] c"int8_t a = %hhd\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U17:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
// CHECK: @__const.unit18.a = private unnamed_addr constant %struct.U18A { x86_fp80 0xK3FFF8FCD67FD3F5B6000 }, align 16
|
||||
// CHECK-NEXT: [[STRUCT_STR_U18:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U18A {\0A\00"
|
||||
// CHECK-NEXT: [[FIELD_U18:@[0-9]+]] = private unnamed_addr constant [17 x i8] c"long double a : \00"
|
||||
// CHECK-NEXT: [[FORMAT_U18:@[0-9]+]] = private unnamed_addr constant [5 x i8] c"%Lf\0A\00"
|
||||
// CHECK-NEXT: [[END_STRUCT_U18:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00"
|
||||
// CHECK-NEXT: [[STRUCT_STR_U18:@[0-9]+]] = private unnamed_addr constant [15 x i8] c"struct U18A {\0A\00", align 1
|
||||
// CHECK-NEXT: [[FIELD_U18:@[0-9]+]] = private unnamed_addr constant [21 x i8] c"long double a = %Lf\0A\00", align 1
|
||||
// CHECK-NEXT: [[END_STRUCT_U18:@[0-9]+]] = private unnamed_addr constant [3 x i8] c"}\0A\00", align 1
|
||||
|
||||
int printf(const char *fmt, ...) {
|
||||
return 0;
|
||||
|
@ -126,10 +107,9 @@ void unit1(void) {
|
|||
.a = 12,
|
||||
};
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U1]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U1A, %struct.U1A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* [[FIELD_U1]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U1A, %struct.U1A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i16, i16* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[FORMAT_U1]], i32 0, i32 0), i16 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U1]], i32 0, i32 0), i16 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U1]], i32 0, i32 0))
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -144,10 +124,9 @@ void unit2(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U2]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U2A, %struct.U2A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* [[FIELD_U2]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U2A, %struct.U2A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i16, i16* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[FORMAT_U2]], i32 0, i32 0), i16 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* [[FIELD_U2]], i32 0, i32 0), i16 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U2]], i32 0, i32 0))
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -162,10 +141,9 @@ void unit3(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U3]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U3A, %struct.U3A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* [[FIELD_U3]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U3A, %struct.U3A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i32, i32* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U3]], i32 0, i32 0), i32 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U3]], i32 0, i32 0), i32 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U3]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -180,10 +158,9 @@ void unit4(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U4]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U4A, %struct.U4A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* [[FIELD_U4]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U4A, %struct.U4A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i32, i32* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U4]], i32 0, i32 0), i32 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* [[FIELD_U4]], i32 0, i32 0), i32 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U4]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -198,10 +175,9 @@ void unit5(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U5]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U5A, %struct.U5A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* [[FIELD_U5]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U5A, %struct.U5A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i64, i64* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[FORMAT_U5]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[FIELD_U5]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U5]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -216,10 +192,9 @@ void unit6(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U6]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U6A, %struct.U6A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[FIELD_U6]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U6A, %struct.U6A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i64, i64* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[FORMAT_U6]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[FIELD_U6]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U6]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -234,10 +209,9 @@ void unit7(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U7]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U7A, %struct.U7A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U7]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U7A, %struct.U7A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i64, i64* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* [[FORMAT_U7]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* [[FIELD_U7]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U7]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -252,10 +226,9 @@ void unit8(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U8]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U8A, %struct.U8A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* [[FIELD_U8]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U8A, %struct.U8A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i64, i64* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* [[FORMAT_U8]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* [[FIELD_U8]], i32 0, i32 0), i64 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U8]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -270,10 +243,9 @@ void unit9(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* [[STRUCT_STR_U9]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U9A, %struct.U9A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* [[FIELD_U9]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U9A, %struct.U9A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8, i8* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U9]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* [[FIELD_U9]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U9]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -288,10 +260,9 @@ void unit10(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U10]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U10A, %struct.U10A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U10]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U10A, %struct.U10A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8*, i8** [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U10]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U10]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U10]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -306,10 +277,9 @@ void unit11(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U11]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U11A, %struct.U11A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U11]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U11A, %struct.U11A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8*, i8** [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U11]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U11]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U11]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -324,10 +294,9 @@ void unit12(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U12]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U12A, %struct.U12A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* [[FIELD_U12]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U12A, %struct.U12A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8*, i8** [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U12]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* [[FIELD_U12]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U12]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -343,10 +312,9 @@ void unit13(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U13]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U13A, %struct.U13A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* [[FIELD_U13]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U13A, %struct.U13A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8*, i8** [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U13]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[FIELD_U13]], i32 0, i32 0), i8* [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U13]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -361,10 +329,9 @@ void unit14(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U14]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U14A, %struct.U14A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U14]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U14A, %struct.U14A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load double, double* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U14]], i32 0, i32 0), double [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U14]], i32 0, i32 0), double [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U14]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -379,10 +346,9 @@ void unit15(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U15]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U15A, %struct.U15A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U15]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U15A, %struct.U15A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load [3 x i32], [3 x i32]* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[FORMAT_U15]], i32 0, i32 0), [3 x i32] [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[FIELD_U15]], i32 0, i32 0), [3 x i32] [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U15]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -397,10 +363,9 @@ void unit16(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U16]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U16A, %struct.U16A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* [[FIELD_U16]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U16A, %struct.U16A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8, i8* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* [[FORMAT_U16]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* [[FIELD_U16]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U16]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -415,10 +380,9 @@ void unit17(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U17]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U17A, %struct.U17A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* [[FIELD_U17]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U17A, %struct.U17A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8, i8* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* [[FORMAT_U17]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* [[FIELD_U17]], i32 0, i32 0), i8 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U17]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -433,10 +397,9 @@ void unit18(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[STRUCT_STR_U18]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U18A, %struct.U18A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* [[FIELD_U18]], i32 0, i32 0))
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.U18A, %struct.U18A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load x86_fp80, x86_fp80* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[FORMAT_U18]], i32 0, i32 0), x86_fp80 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* [[FIELD_U18]], i32 0, i32 0), x86_fp80 [[LOAD1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[END_STRUCT_U18]], i32 0, i32 0)
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
@ -453,12 +416,10 @@ void test1(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.T1A, %struct.T1A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[a-z0-9]+]] = getelementptr inbounds %struct.T1A, %struct.T1A* %a, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i32, i32* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i32 [[LOAD1]])
|
||||
// CHECK: [[RES2:%[0-9]+]] = getelementptr inbounds %struct.T1A, %struct.T1A* %a, i32 0, i32 1
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES2:%[a-z0-9]+]] = getelementptr inbounds %struct.T1A, %struct.T1A* %a, i32 0, i32 1
|
||||
// CHECK: [[LOAD2:%[0-9]+]] = load i8*, i8** [[RES2]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i8* [[LOAD2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
|
@ -483,14 +444,12 @@ void test2(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.T2B, %struct.T2B* %b, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[a-z0-9]+]] = getelementptr inbounds %struct.T2B, %struct.T2B* %b, i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i32, i32* [[RES1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i32 [[LOAD1]])
|
||||
// CHECK: [[NESTED_STRUCT:%[0-9]+]] = getelementptr inbounds %struct.T2B, %struct.T2B* %b, i32 0, i32 1
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES2:%[0-9]+]] = getelementptr inbounds %struct.T2A, %struct.T2A* [[NESTED_STRUCT]], i32 0, i32 0
|
||||
// CHECK: [[NESTED_STRUCT:%[a-z0-9]+]] = getelementptr inbounds %struct.T2B, %struct.T2B* %b, i32 0, i32 1
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES2:%[a-z0-9]+]] = getelementptr inbounds %struct.T2A, %struct.T2A* [[NESTED_STRUCT]], i32 0, i32 0
|
||||
// CHECK: [[LOAD2:%[0-9]+]] = load i32, i32* [[RES2]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i32 [[LOAD2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
|
@ -510,15 +469,16 @@ void test3(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.T3A, %struct.T3A* %a, i32 0, i32 0
|
||||
// CHECK: [[RES1:%[a-z0-9]+]] = getelementptr inbounds %struct.T3A, %struct.T3A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC1:%[0-9]+]] = bitcast %union.anon* [[RES1]] to i32*
|
||||
// CHECK: [[BC1:%[a-z0-9]+]] = bitcast %union.anon* [[RES1]] to i32*
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i32, i32* [[BC1]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i32 [[LOAD1]])
|
||||
// CHECK: [[BC2:%[0-9]+]] = bitcast %union.anon* [[RES1]] to [4 x i8]*
|
||||
// CHECK: [[BC2:%[a-z0-9]+]] = bitcast %union.anon* [[RES1]] to [4 x i8]*
|
||||
// CHECK: [[LOAD2:%[0-9]+]] = load [4 x i8], [4 x i8]* [[BC2]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, [4 x i8] [[LOAD2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
||||
|
@ -539,17 +499,141 @@ void test4(void) {
|
|||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.T4A, %struct.T4A* %a, i32 0, i32 0
|
||||
// CHECK: [[RES1:%[a-z0-9]+]] = getelementptr inbounds %struct.T4A, %struct.T4A* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC1:%[0-9]+]] = bitcast %union.anon.0* [[RES1]] to %struct.anon*
|
||||
// CHECK: [[RES2:%[0-9]+]] = getelementptr inbounds %struct.anon, %struct.anon* [[BC1]], i32 0, i32 0
|
||||
// CHECK: [[BC1:%[a-z0-9]+]] = bitcast %union.anon.0* [[RES1]] to %struct.anon*
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES2:%[a-z0-9]+]] = getelementptr inbounds %struct.anon, %struct.anon* [[BC1]], i32 0, i32 0
|
||||
// CHECK: [[LOAD1:%[0-9]+]] = load i8*, i8** [[RES2]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i8* [[LOAD1]])
|
||||
|
||||
// CHECK: [[BC2:%[0-9]+]] = bitcast %union.anon.0* [[RES1]] to %struct.anon.1*
|
||||
// CHECK: [[RES3:%[0-9]+]] = getelementptr inbounds %struct.anon.1, %struct.anon.1* [[BC2]], i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC2:%[a-z0-9]+]] = bitcast %union.anon.0* [[RES1]] to %struct.anon.1*
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES3:%[a-z0-9]+]] = getelementptr inbounds %struct.anon.1, %struct.anon.1* [[BC2]], i32 0, i32 0
|
||||
// CHECK: [[LOAD2:%[0-9]+]] = load i64, i64* [[RES3]],
|
||||
// CHECK: call i32 (i8*, ...) @printf({{.*}}, i64 [[LOAD2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
||||
void test5(void) {
|
||||
struct T5A {
|
||||
unsigned a : 1;
|
||||
};
|
||||
|
||||
struct T5A a = {
|
||||
.a = 0,
|
||||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* {{.*}}, i32 0, i32 0))
|
||||
// CHECK: [[BC1:%[0-9a-z.]+]] = bitcast %struct.T5A* %a to i8*
|
||||
// CHECK: [[LOAD1:%[0-9a-z.]+]] = load i8, i8* [[BC1]],
|
||||
// CHECK: [[CLEAR1:%[0-9a-z.]+]] = and i8 [[LOAD1]], 1
|
||||
// CHECK: [[CAST1:%[0-9a-z.]+]] = zext i8 [[CLEAR1]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
||||
void test6(void) {
|
||||
struct T6A {
|
||||
unsigned a : 1;
|
||||
unsigned b : 1;
|
||||
unsigned c : 1;
|
||||
};
|
||||
|
||||
struct T6A a = {
|
||||
.a = 1,
|
||||
.b = 0,
|
||||
.c = 1,
|
||||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC1:%[0-9a-z.]+]] = bitcast %struct.T6A* %a to i8*
|
||||
// CHECK: [[LOAD1:%[0-9a-z.]+]] = load i8, i8* [[BC1]],
|
||||
// CHECK: [[CLEAR1:%[0-9a-z.]+]] = and i8 [[LOAD1]], 1
|
||||
// CHECK: [[CAST1:%[0-9a-z.]+]] = zext i8 [[CLEAR1]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST1]])
|
||||
// CHECK: [[BC2:%[0-9a-z.]+]] = bitcast %struct.T6A* %a to i8*
|
||||
// CHECK: [[LOAD2:%[0-9a-z.]+]] = load i8, i8* [[BC2]], align 4
|
||||
// CHECK: [[LSHR2:%[0-9a-z.]+]] = lshr i8 [[LOAD2]], 1
|
||||
// CHECK: [[CLEAR2:%[0-9a-z.]+]] = and i8 [[LSHR2]], 1
|
||||
// CHECK: [[CAST2:%[0-9a-z.]+]] = zext i8 [[CLEAR2]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST2]])
|
||||
// CHECK: [[BC3:%[0-9a-z.]+]] = bitcast %struct.T6A* %a to i8*
|
||||
// CHECK: [[LOAD3:%[0-9a-z.]+]] = load i8, i8* [[BC3]], align 4
|
||||
// CHECK: [[LSHR3:%[0-9a-z.]+]] = lshr i8 [[LOAD3]], 2
|
||||
// CHECK: [[CLEAR3:%[0-9a-z.]+]] = and i8 [[LSHR3]], 1
|
||||
// CHECK: [[CAST3:%[0-9a-z.]+]] = zext i8 [[CLEAR3]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST3]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
||||
void test7(void) {
|
||||
|
||||
struct T7A {
|
||||
unsigned a : 1;
|
||||
};
|
||||
|
||||
struct T7B {
|
||||
struct T7A a;
|
||||
unsigned b : 1;
|
||||
};
|
||||
|
||||
struct T7B a = {
|
||||
.a = {.a = 0},
|
||||
.b = 1,
|
||||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES1:%[−a−zA−Z._0-9]+]] = getelementptr inbounds %struct.T7B, %struct.T7B* %a, i32 0, i32 0
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC1:%[−a−zA−Z._0-9]+]] = bitcast %struct.T7A* [[RES1]] to i8*
|
||||
// CHECK: [[LOAD1:%[-a-zA-Z._0-9]+]] = load i8, i8* [[BC1]],
|
||||
// CHECK: [[CLEAR1:%[-a-zA-Z._0-9]+]] = and i8 [[LOAD1]], 1
|
||||
// CHECK: [[CAST1:%[-a-zA-Z._0-9]+]] = zext i8 [[CLEAR1]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST1]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES2:%[-a-zA-Z._0-9]+]] = getelementptr inbounds %struct.T7B, %struct.T7B* %a, i32 0, i32 1
|
||||
// CHECK: [[LOAD2:%[-a-zA-Z._0-9]+]] = load i8, i8* [[RES2]], align 4
|
||||
// CHECK: [[CLEAR2:%[-a-zA-Z._0-9]+]] = and i8 [[LOAD2]], 1
|
||||
// CHECK: [[CAST2:%[-a-zA-Z._0-9]+]] = zext i8 [[CLEAR2]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
||||
void test8(void) {
|
||||
struct T8A {
|
||||
unsigned c : 1;
|
||||
unsigned : 3;
|
||||
unsigned : 0;
|
||||
unsigned b;
|
||||
};
|
||||
|
||||
struct T8A a = {
|
||||
.b = 2022,
|
||||
};
|
||||
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[BC1:%[−a−zA−Z._0-9]+]] = bitcast %struct.T8A* %a to i8*
|
||||
// CHECK: [[LOAD1:%[-a-zA-Z._0-9]+]] = load i8, i8* [[BC1]],
|
||||
// CHECK: [[CLEAR1:%[-a-zA-Z._0-9]+]] = and i8 [[LOAD1]], 1
|
||||
// CHECK: [[CAST1:%[-a-zA-Z._0-9]+]] = zext i8 [[CLEAR1]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST1]])
|
||||
// CHECK: [[BC2:%[−a−zA−Z._0-9]+]] = bitcast %struct.T8A* %a to i8*
|
||||
// CHECK: [[LOAD2:%[-a-zA-Z._0-9]+]] = load i8, i8* [[BC2]],
|
||||
// CHECK: [[LSHR2:%[0-9a-z.]+]] = lshr i8 [[LOAD2]], 1
|
||||
// CHECK: [[CLEAR2:%[-a-zA-Z._0-9]+]] = and i8 [[LSHR2]], 7
|
||||
// CHECK: [[CAST2:%[-a-zA-Z._0-9]+]] = zext i8 [[CLEAR2]] to i32
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* {{.*}}, i32 0, i32 0), i32 [[CAST2]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
// CHECK: [[RES3:%[-a-zA-Z._0-9]+]] = getelementptr inbounds %struct.T8A, %struct.T8A* %a, i32 0, i32 1
|
||||
// CHECK: [[LOAD3:%[-a-zA-Z._0-9]+]] = load i32, i32* [[RES3]],
|
||||
// CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* {{.*}}, i32 0, i32 0), i32 [[LOAD3]])
|
||||
// CHECK: call i32 (i8*, ...) @printf(
|
||||
__builtin_dump_struct(&a, &printf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue