From: Peter Collingbourne Date: Mon, 11 Sep 2017 22:49:10 +0000 (+0000) Subject: LowerTypeTests: Add import/export support for targets without absolute symbol constants. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a8b825606fb466013199bc7ee5d058e849dd2ec;p=llvm LowerTypeTests: Add import/export support for targets without absolute symbol constants. The rationale is the same as for r312967. Differential Revision: https://reviews.llvm.org/D37408 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312968 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/ModuleSummaryIndex.h b/include/llvm/IR/ModuleSummaryIndex.h index 7e3492545b6..242233ece4b 100644 --- a/include/llvm/IR/ModuleSummaryIndex.h +++ b/include/llvm/IR/ModuleSummaryIndex.h @@ -487,6 +487,16 @@ struct TypeTestResolution { /// range [1,256], this number will be 8. This helps generate the most compact /// instruction sequences. unsigned SizeM1BitWidth = 0; + + // The following fields are only used if the target does not support the use + // of absolute symbols to store constants. Their meanings are the same as the + // corresponding fields in LowerTypeTestsModule::TypeIdLowering in + // LowerTypeTests.cpp. + + uint64_t AlignLog2 = 0; + uint64_t SizeM1 = 0; + uint8_t BitMask = 0; + uint64_t InlineBits = 0; }; struct WholeProgramDevirtResolution { diff --git a/include/llvm/IR/ModuleSummaryIndexYAML.h b/include/llvm/IR/ModuleSummaryIndexYAML.h index a287eb399fe..2f9990ca03d 100644 --- a/include/llvm/IR/ModuleSummaryIndexYAML.h +++ b/include/llvm/IR/ModuleSummaryIndexYAML.h @@ -30,6 +30,10 @@ template <> struct MappingTraits { static void mapping(IO &io, TypeTestResolution &res) { io.mapOptional("Kind", res.TheKind); io.mapOptional("SizeM1BitWidth", res.SizeM1BitWidth); + io.mapOptional("AlignLog2", res.AlignLog2); + io.mapOptional("SizeM1", res.SizeM1); + io.mapOptional("BitMask", res.BitMask); + io.mapOptional("InlineBits", res.InlineBits); } }; diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp index a13170cf8ad..fad6d5ca006 100644 --- a/lib/LTO/LTO.cpp +++ b/lib/LTO/LTO.cpp @@ -217,6 +217,11 @@ static void computeCacheKey( AddUnsigned(S.TTRes.TheKind); AddUnsigned(S.TTRes.SizeM1BitWidth); + AddUint64(S.TTRes.AlignLog2); + AddUint64(S.TTRes.SizeM1); + AddUint64(S.TTRes.BitMask); + AddUint64(S.TTRes.InlineBits); + AddUint64(S.WPDRes.size()); for (auto &WPD : S.WPDRes) { AddUnsigned(WPD.first); diff --git a/lib/Transforms/IPO/LowerTypeTests.cpp b/lib/Transforms/IPO/LowerTypeTests.cpp index 79424edb14c..49cc14c5b59 100644 --- a/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/lib/Transforms/IPO/LowerTypeTests.cpp @@ -197,6 +197,7 @@ struct ByteArrayInfo { uint64_t BitSize; GlobalVariable *ByteArray; GlobalVariable *MaskGlobal; + uint8_t *MaskPtr = nullptr; }; /// A POD-like structure that we use to store a global reference together with @@ -307,7 +308,8 @@ class LowerTypeTestsModule { Function *WeakInitializerFn = nullptr; - void exportTypeId(StringRef TypeId, const TypeIdLowering &TIL); + bool shouldExportConstantsAsAbsoluteSymbols(); + uint8_t *exportTypeId(StringRef TypeId, const TypeIdLowering &TIL); TypeIdLowering importTypeId(StringRef TypeId); void importTypeTest(CallInst *CI); void importFunction(Function *F, bool isDefinition); @@ -474,6 +476,8 @@ void LowerTypeTestsModule::allocateByteArrays() { BAI->MaskGlobal->replaceAllUsesWith( ConstantExpr::getIntToPtr(ConstantInt::get(Int8Ty, Mask), Int8PtrTy)); BAI->MaskGlobal->eraseFromParent(); + if (BAI->MaskPtr) + *BAI->MaskPtr = Mask; } Constant *ByteArrayConst = ConstantDataArray::get(M.getContext(), BAB.Bytes); @@ -725,13 +729,21 @@ void LowerTypeTestsModule::buildBitSetsFromGlobalVariables( } } +bool LowerTypeTestsModule::shouldExportConstantsAsAbsoluteSymbols() { + return (Arch == Triple::x86 || Arch == Triple::x86_64) && + ObjectFormat == Triple::ELF; +} + /// Export the given type identifier so that ThinLTO backends may import it. /// Type identifiers are exported by adding coarse-grained information about how /// to test the type identifier to the summary, and creating symbols in the /// object file (aliases and absolute symbols) containing fine-grained /// information about the type identifier. -void LowerTypeTestsModule::exportTypeId(StringRef TypeId, - const TypeIdLowering &TIL) { +/// +/// Returns a pointer to the location in which to store the bitmask, if +/// applicable. +uint8_t *LowerTypeTestsModule::exportTypeId(StringRef TypeId, + const TypeIdLowering &TIL) { TypeTestResolution &TTRes = ExportSummary->getOrInsertTypeIdSummary(TypeId).TTRes; TTRes.TheKind = TIL.TheKind; @@ -743,14 +755,21 @@ void LowerTypeTestsModule::exportTypeId(StringRef TypeId, GA->setVisibility(GlobalValue::HiddenVisibility); }; + auto ExportConstant = [&](StringRef Name, uint64_t &Storage, Constant *C) { + if (shouldExportConstantsAsAbsoluteSymbols()) + ExportGlobal(Name, ConstantExpr::getIntToPtr(C, Int8PtrTy)); + else + Storage = cast(C)->getZExtValue(); + }; + if (TIL.TheKind != TypeTestResolution::Unsat) ExportGlobal("global_addr", TIL.OffsetedGlobal); if (TIL.TheKind == TypeTestResolution::ByteArray || TIL.TheKind == TypeTestResolution::Inline || TIL.TheKind == TypeTestResolution::AllOnes) { - ExportGlobal("align", ConstantExpr::getIntToPtr(TIL.AlignLog2, Int8PtrTy)); - ExportGlobal("size_m1", ConstantExpr::getIntToPtr(TIL.SizeM1, Int8PtrTy)); + ExportConstant("align", TTRes.AlignLog2, TIL.AlignLog2); + ExportConstant("size_m1", TTRes.SizeM1, TIL.SizeM1); uint64_t BitSize = cast(TIL.SizeM1)->getZExtValue() + 1; if (TIL.TheKind == TypeTestResolution::Inline) @@ -761,12 +780,16 @@ void LowerTypeTestsModule::exportTypeId(StringRef TypeId, if (TIL.TheKind == TypeTestResolution::ByteArray) { ExportGlobal("byte_array", TIL.TheByteArray); - ExportGlobal("bit_mask", TIL.BitMask); + if (shouldExportConstantsAsAbsoluteSymbols()) + ExportGlobal("bit_mask", TIL.BitMask); + else + return &TTRes.BitMask; } if (TIL.TheKind == TypeTestResolution::Inline) - ExportGlobal("inline_bits", - ConstantExpr::getIntToPtr(TIL.InlineBits, Int8PtrTy)); + ExportConstant("inline_bits", TTRes.InlineBits, TIL.InlineBits); + + return nullptr; } LowerTypeTestsModule::TypeIdLowering @@ -779,16 +802,31 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) { TypeIdLowering TIL; TIL.TheKind = TTRes.TheKind; - auto ImportGlobal = [&](StringRef Name, unsigned AbsWidth) { + auto ImportGlobal = [&](StringRef Name) { Constant *C = M.getOrInsertGlobal(("__typeid_" + TypeId + "_" + Name).str(), Int8Ty); - auto *GV = dyn_cast(C); - // We only need to set metadata if the global is newly created, in which - // case it would not have hidden visibility. - if (!GV || GV->getVisibility() == GlobalValue::HiddenVisibility) + if (auto *GV = dyn_cast(C)) + GV->setVisibility(GlobalValue::HiddenVisibility); + return C; + }; + + auto ImportConstant = [&](StringRef Name, uint64_t Const, unsigned AbsWidth, + Type *Ty) { + if (!shouldExportConstantsAsAbsoluteSymbols()) { + Constant *C = + ConstantInt::get(isa(Ty) ? Ty : Int64Ty, Const); + if (!isa(Ty)) + C = ConstantExpr::getIntToPtr(C, Ty); + return C; + } + + Constant *C = ImportGlobal(Name); + auto *GV = cast(C->stripPointerCasts()); + if (isa(Ty)) + C = ConstantExpr::getPtrToInt(C, Ty); + if (GV->getMetadata(LLVMContext::MD_absolute_symbol)) return C; - GV->setVisibility(GlobalValue::HiddenVisibility); auto SetAbsRange = [&](uint64_t Min, uint64_t Max) { auto *MinC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Min)); auto *MaxC = ConstantAsMetadata::get(ConstantInt::get(IntPtrTy, Max)); @@ -797,30 +835,30 @@ LowerTypeTestsModule::importTypeId(StringRef TypeId) { }; if (AbsWidth == IntPtrTy->getBitWidth()) SetAbsRange(~0ull, ~0ull); // Full set. - else if (AbsWidth) + else SetAbsRange(0, 1ull << AbsWidth); return C; }; if (TIL.TheKind != TypeTestResolution::Unsat) - TIL.OffsetedGlobal = ImportGlobal("global_addr", 0); + TIL.OffsetedGlobal = ImportGlobal("global_addr"); if (TIL.TheKind == TypeTestResolution::ByteArray || TIL.TheKind == TypeTestResolution::Inline || TIL.TheKind == TypeTestResolution::AllOnes) { - TIL.AlignLog2 = ConstantExpr::getPtrToInt(ImportGlobal("align", 8), Int8Ty); - TIL.SizeM1 = ConstantExpr::getPtrToInt( - ImportGlobal("size_m1", TTRes.SizeM1BitWidth), IntPtrTy); + TIL.AlignLog2 = ImportConstant("align", TTRes.AlignLog2, 8, Int8Ty); + TIL.SizeM1 = + ImportConstant("size_m1", TTRes.SizeM1, TTRes.SizeM1BitWidth, IntPtrTy); } if (TIL.TheKind == TypeTestResolution::ByteArray) { - TIL.TheByteArray = ImportGlobal("byte_array", 0); - TIL.BitMask = ImportGlobal("bit_mask", 8); + TIL.TheByteArray = ImportGlobal("byte_array"); + TIL.BitMask = ImportConstant("bit_mask", TTRes.BitMask, 8, Int8PtrTy); } if (TIL.TheKind == TypeTestResolution::Inline) - TIL.InlineBits = ConstantExpr::getPtrToInt( - ImportGlobal("inline_bits", 1 << TTRes.SizeM1BitWidth), + TIL.InlineBits = ImportConstant( + "inline_bits", TTRes.InlineBits, 1 << TTRes.SizeM1BitWidth, TTRes.SizeM1BitWidth <= 5 ? Int32Ty : Int64Ty); return TIL; @@ -899,6 +937,7 @@ void LowerTypeTestsModule::lowerTypeTestCalls( BSI.print(dbgs()); }); + ByteArrayInfo *BAI = nullptr; TypeIdLowering TIL; TIL.OffsetedGlobal = ConstantExpr::getGetElementPtr( Int8Ty, CombinedGlobalAddr, ConstantInt::get(IntPtrTy, BSI.ByteOffset)), @@ -920,15 +959,18 @@ void LowerTypeTestsModule::lowerTypeTestCalls( } else { TIL.TheKind = TypeTestResolution::ByteArray; ++NumByteArraysCreated; - ByteArrayInfo *BAI = createByteArray(BSI); + BAI = createByteArray(BSI); TIL.TheByteArray = BAI->ByteArray; TIL.BitMask = BAI->MaskGlobal; } TypeIdUserInfo &TIUI = TypeIdUsers[TypeId]; - if (TIUI.IsExported) - exportTypeId(cast(TypeId)->getString(), TIL); + if (TIUI.IsExported) { + uint8_t *MaskPtr = exportTypeId(cast(TypeId)->getString(), TIL); + if (BAI) + BAI->MaskPtr = MaskPtr; + } // Lower each call to llvm.type.test for this type identifier. for (CallInst *CI : TIUI.CallSites) { diff --git a/test/Transforms/LowerTypeTests/Inputs/import.yaml b/test/Transforms/LowerTypeTests/Inputs/import.yaml index d4a5c2c3c25..7a57d8c4f25 100644 --- a/test/Transforms/LowerTypeTests/Inputs/import.yaml +++ b/test/Transforms/LowerTypeTests/Inputs/import.yaml @@ -4,26 +4,42 @@ TypeIdMap: TTRes: Kind: AllOnes SizeM1BitWidth: 7 + AlignLog2: 1 + SizeM1: 42 allones32: TTRes: Kind: AllOnes SizeM1BitWidth: 32 + AlignLog2: 2 + SizeM1: 12345 bytearray7: TTRes: Kind: ByteArray SizeM1BitWidth: 7 + AlignLog2: 3 + SizeM1: 43 + BitMask: 64 bytearray32: TTRes: Kind: ByteArray SizeM1BitWidth: 32 + AlignLog2: 4 + SizeM1: 12346 + BitMask: 128 inline5: TTRes: Kind: Inline SizeM1BitWidth: 5 + AlignLog2: 5 + SizeM1: 31 + InlineBits: 123 inline6: TTRes: Kind: Inline SizeM1BitWidth: 6 + AlignLog2: 6 + SizeM1: 63 + InlineBits: 1000000000000 single: TTRes: Kind: Single diff --git a/test/Transforms/LowerTypeTests/export-allones.ll b/test/Transforms/LowerTypeTests/export-allones.ll index a642ec87355..00af10449df 100644 --- a/test/Transforms/LowerTypeTests/export-allones.ll +++ b/test/Transforms/LowerTypeTests/export-allones.ll @@ -1,5 +1,8 @@ -; RUN: opt -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck %s -; RUN: FileCheck --check-prefix=SUMMARY %s < %t +; RUN: opt -mtriple=x86_64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,X86 %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-X86 %s < %t + +; RUN: opt -mtriple=aarch64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,ARM %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-ARM %s < %t @foo = constant [2048 x i8] zeroinitializer, !type !0, !type !1, !type !2, !type !3, !type !4, !type !5, !type !6, !type !7, !type !8, !type !9, !type !10, !type !11, !type !12, !type !13, !type !14, !type !15, !type !16, !type !17, !type !18, !type !19, !type !20, !type !21, !type !22, !type !23, !type !24, !type !25, !type !26, !type !27, !type !28, !type !29, !type !30, !type !31, !type !32, !type !33, !type !34, !type !35, !type !36, !type !37, !type !38, !type !39, !type !40, !type !41, !type !42, !type !43, !type !44, !type !45, !type !46, !type !47, !type !48, !type !49, !type !50, !type !51, !type !52, !type !53, !type !54, !type !55, !type !56, !type !57, !type !58, !type !59, !type !60, !type !61, !type !62, !type !63, !type !64, !type !65, !type !66, !type !67, !type !68, !type !69, !type !70, !type !71, !type !72, !type !73, !type !74, !type !75, !type !76, !type !77, !type !78, !type !79, !type !80, !type !81, !type !82, !type !83, !type !84, !type !85, !type !86, !type !87, !type !88, !type !89, !type !90, !type !91, !type !92, !type !93, !type !94, !type !95, !type !96, !type !97, !type !98, !type !99, !type !100, !type !101, !type !102, !type !103, !type !104, !type !105, !type !106, !type !107, !type !108, !type !109, !type !110, !type !111, !type !112, !type !113, !type !114, !type !115, !type !116, !type !117, !type !118, !type !119, !type !120, !type !121, !type !122, !type !123, !type !124, !type !125, !type !126, !type !127, !type !128, !type !129, !type !130 @@ -139,12 +142,14 @@ ; CHECK: [[G:@[0-9]+]] = private constant { [2048 x i8] } zeroinitializer ; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0) -; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) -; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 1 to i8*) +; X86: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) +; X86: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 1 to i8*) ; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4) -; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) -; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 128 to i8*) +; X86: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) +; X86: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 128 to i8*) + +; ARM-NOT: alias {{.*}} inttoptr ; CHECK: @foo = alias [2048 x i8], getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0) @@ -153,9 +158,25 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: AllOnes ; SUMMARY-NEXT: SizeM1BitWidth: 7 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 1 +; SUMMARY-ARM-NEXT: SizeM1: 1 +; SUMMARY-ARM-NEXT: BitMask: 0 +; SUMMARY-ARM-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: typeid2: ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: AllOnes ; SUMMARY-NEXT: SizeM1BitWidth: 32 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 2 +; SUMMARY-ARM-NEXT: SizeM1: 128 +; SUMMARY-ARM-NEXT: BitMask: 0 +; SUMMARY-ARM-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: diff --git a/test/Transforms/LowerTypeTests/export-bytearray.ll b/test/Transforms/LowerTypeTests/export-bytearray.ll index 7565b85df30..aa06a8d5661 100644 --- a/test/Transforms/LowerTypeTests/export-bytearray.ll +++ b/test/Transforms/LowerTypeTests/export-bytearray.ll @@ -1,5 +1,8 @@ -; RUN: opt -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck %s -; RUN: FileCheck --check-prefix=SUMMARY %s < %t +; RUN: opt -mtriple=x86_64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,X86 %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-X86 %s < %t + +; RUN: opt -mtriple=aarch64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,ARM %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-ARM %s < %t @foo = constant [2048 x i8] zeroinitializer, !type !0, !type !1, !type !2, !type !3 @@ -12,16 +15,18 @@ ; CHECK: [[B:@[0-9]+]] = private constant [258 x i8] c"\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\01" ; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0) -; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) -; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 65 to i8*) +; X86: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) +; X86: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 65 to i8*) ; CHECK: @__typeid_typeid1_byte_array = hidden alias i8, i8* @bits.1 -; CHECK: @__typeid_typeid1_bit_mask = hidden alias i8, inttoptr (i8 2 to i8*) +; X86: @__typeid_typeid1_bit_mask = hidden alias i8, inttoptr (i8 2 to i8*) ; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4) -; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) -; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 257 to i8*) +; X86: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) +; X86: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 257 to i8*) ; CHECK: @__typeid_typeid2_byte_array = hidden alias i8, i8* @bits -; CHECK: @__typeid_typeid2_bit_mask = hidden alias i8, inttoptr (i8 1 to i8*) +; X86: @__typeid_typeid2_bit_mask = hidden alias i8, inttoptr (i8 1 to i8*) + +; ARM-NOT: alias {{.*}} inttoptr ; CHECK: @foo = alias [2048 x i8], getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0) ; CHECK: @bits = private alias i8, getelementptr inbounds ([258 x i8], [258 x i8]* [[B]], i64 0, i64 0) @@ -32,9 +37,25 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: ByteArray ; SUMMARY-NEXT: SizeM1BitWidth: 7 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 1 +; SUMMARY-ARM-NEXT: SizeM1: 65 +; SUMMARY-ARM-NEXT: BitMask: 2 +; SUMMARY-ARM-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: typeid2: ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: ByteArray ; SUMMARY-NEXT: SizeM1BitWidth: 32 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 2 +; SUMMARY-ARM-NEXT: SizeM1: 257 +; SUMMARY-ARM-NEXT: BitMask: 1 +; SUMMARY-ARM-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: diff --git a/test/Transforms/LowerTypeTests/export-icall.ll b/test/Transforms/LowerTypeTests/export-icall.ll index 0a1af66883c..ccbb07aec37 100644 --- a/test/Transforms/LowerTypeTests/export-icall.ll +++ b/test/Transforms/LowerTypeTests/export-icall.ll @@ -65,11 +65,19 @@ define void @f3(i32 %x) !type !8 { ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: AllOnes ; SUMMARY-NEXT: SizeM1BitWidth: 7 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: typeid2: ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Single ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY: CfiFunctionDefs: diff --git a/test/Transforms/LowerTypeTests/export-inline.ll b/test/Transforms/LowerTypeTests/export-inline.ll index 1da5866e88c..54e0d42c33c 100644 --- a/test/Transforms/LowerTypeTests/export-inline.ll +++ b/test/Transforms/LowerTypeTests/export-inline.ll @@ -1,5 +1,8 @@ -; RUN: opt -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck %s -; RUN: FileCheck --check-prefix=SUMMARY %s < %t +; RUN: opt -mtriple=x86_64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,X86 %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-X86 %s < %t + +; RUN: opt -mtriple=aarch64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck --check-prefixes=CHECK,ARM %s +; RUN: FileCheck --check-prefixes=SUMMARY,SUMMARY-ARM %s < %t @foo = constant [2048 x i8] zeroinitializer, !type !0, !type !1, !type !2, !type !3 @@ -11,14 +14,14 @@ ; CHECK: [[G:@[0-9]+]] = private constant { [2048 x i8] } zeroinitializer ; CHECK: @__typeid_typeid1_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i32 0) -; CHECK: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) -; CHECK: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 3 to i8*) -; CHECK: @__typeid_typeid1_inline_bits = hidden alias i8, inttoptr (i32 9 to i8*) +; CHECK-X86: @__typeid_typeid1_align = hidden alias i8, inttoptr (i8 1 to i8*) +; CHECK-X86: @__typeid_typeid1_size_m1 = hidden alias i8, inttoptr (i64 3 to i8*) +; CHECK-X86: @__typeid_typeid1_inline_bits = hidden alias i8, inttoptr (i32 9 to i8*) ; CHECK: @__typeid_typeid2_global_addr = hidden alias i8, getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0, i64 4) -; CHECK: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) -; CHECK: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 33 to i8*) -; CHECK: @__typeid_typeid2_inline_bits = hidden alias i8, inttoptr (i64 8589934593 to i8*) +; CHECK-X86: @__typeid_typeid2_align = hidden alias i8, inttoptr (i8 2 to i8*) +; CHECK-X86: @__typeid_typeid2_size_m1 = hidden alias i8, inttoptr (i64 33 to i8*) +; CHECK-X86: @__typeid_typeid2_inline_bits = hidden alias i8, inttoptr (i64 8589934593 to i8*) ; CHECK: @foo = alias [2048 x i8], getelementptr inbounds ({ [2048 x i8] }, { [2048 x i8] }* [[G]], i32 0, i32 0) @@ -27,9 +30,25 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Inline ; SUMMARY-NEXT: SizeM1BitWidth: 5 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 1 +; SUMMARY-ARM-NEXT: SizeM1: 3 +; SUMMARY-ARM-NEXT: BitMask: 0 +; SUMMARY-ARM-NEXT: InlineBits: 9 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: typeid2: ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Inline ; SUMMARY-NEXT: SizeM1BitWidth: 6 +; SUMMARY-X86-NEXT: AlignLog2: 0 +; SUMMARY-X86-NEXT: SizeM1: 0 +; SUMMARY-X86-NEXT: BitMask: 0 +; SUMMARY-X86-NEXT: InlineBits: 0 +; SUMMARY-ARM-NEXT: AlignLog2: 2 +; SUMMARY-ARM-NEXT: SizeM1: 33 +; SUMMARY-ARM-NEXT: BitMask: 0 +; SUMMARY-ARM-NEXT: InlineBits: 8589934593 ; SUMMARY-NEXT: WPDRes: diff --git a/test/Transforms/LowerTypeTests/import.ll b/test/Transforms/LowerTypeTests/import.ll index 1a5aceccd63..f397fa7c7b8 100644 --- a/test/Transforms/LowerTypeTests/import.ll +++ b/test/Transforms/LowerTypeTests/import.ll @@ -1,4 +1,5 @@ -; RUN: opt -S -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%S/Inputs/import.yaml < %s | FileCheck %s +; RUN: opt -mtriple=x86_64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%S/Inputs/import.yaml < %s | FileCheck --check-prefixes=CHECK,X86 %s +; RUN: opt -mtriple=aarch64-unknown-linux -S -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%S/Inputs/import.yaml < %s | FileCheck --check-prefixes=CHECK,ARM %s target datalayout = "e-p:64:64" @@ -6,38 +7,41 @@ declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone ; CHECK-DAG: @__typeid_single_global_addr = external hidden global i8 ; CHECK-DAG: @__typeid_inline6_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_inline6_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_inline6_size_m1 = external hidden global i8, !absolute_symbol !1 -; CHECK-DAG: @__typeid_inline6_inline_bits = external hidden global i8, !absolute_symbol !2 +; X86-DAG: @__typeid_inline6_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_inline6_size_m1 = external hidden global i8, !absolute_symbol !1 +; X86-DAG: @__typeid_inline6_inline_bits = external hidden global i8, !absolute_symbol !2 ; CHECK-DAG: @__typeid_inline5_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_inline5_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_inline5_size_m1 = external hidden global i8, !absolute_symbol !3 -; CHECK-DAG: @__typeid_inline5_inline_bits = external hidden global i8, !absolute_symbol !4 +; X86-DAG: @__typeid_inline5_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_inline5_size_m1 = external hidden global i8, !absolute_symbol !3 +; X86-DAG: @__typeid_inline5_inline_bits = external hidden global i8, !absolute_symbol !4 ; CHECK-DAG: @__typeid_bytearray32_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_bytearray32_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_bytearray32_size_m1 = external hidden global i8, !absolute_symbol !4 +; X86-DAG: @__typeid_bytearray32_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_bytearray32_size_m1 = external hidden global i8, !absolute_symbol !4 ; CHECK-DAG: @__typeid_bytearray32_byte_array = external hidden global i8 -; CHECK-DAG: @__typeid_bytearray32_bit_mask = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_bytearray32_bit_mask = external hidden global i8, !absolute_symbol !0 ; CHECK-DAG: @__typeid_bytearray7_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_bytearray7_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_bytearray7_size_m1 = external hidden global i8, !absolute_symbol !5 +; X86-DAG: @__typeid_bytearray7_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_bytearray7_size_m1 = external hidden global i8, !absolute_symbol !5 ; CHECK-DAG: @__typeid_bytearray7_byte_array = external hidden global i8 -; CHECK-DAG: @__typeid_bytearray7_bit_mask = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_bytearray7_bit_mask = external hidden global i8, !absolute_symbol !0 ; CHECK-DAG: @__typeid_allones32_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_allones32_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_allones32_size_m1 = external hidden global i8, !absolute_symbol !4 +; X86-DAG: @__typeid_allones32_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_allones32_size_m1 = external hidden global i8, !absolute_symbol !4 ; CHECK-DAG: @__typeid_allones7_global_addr = external hidden global i8 -; CHECK-DAG: @__typeid_allones7_align = external hidden global i8, !absolute_symbol !0 -; CHECK-DAG: @__typeid_allones7_size_m1 = external hidden global i8, !absolute_symbol !5 +; X86-DAG: @__typeid_allones7_align = external hidden global i8, !absolute_symbol !0 +; X86-DAG: @__typeid_allones7_size_m1 = external hidden global i8, !absolute_symbol !5 ; CHECK: define i1 @allones7(i8* [[p:%.*]]) define i1 @allones7(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_allones7_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_allones7_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_allones7_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_allones7_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_allones7_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 1 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 63 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_allones7_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_allones7_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 42 ; CHECK-NEXT: ret i1 [[ule]] %x = call i1 @llvm.type.test(i8* %p, metadata !"allones7") ret i1 %x @@ -47,10 +51,13 @@ define i1 @allones7(i8* %p) { define i1 @allones32(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_allones32_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_allones32_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_allones32_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_allones32_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_allones32_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 2 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 62 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_allones32_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_allones32_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 12345 ; CHECK-NEXT: ret i1 [[ule]] %x = call i1 @llvm.type.test(i8* %p, metadata !"allones32") ret i1 %x @@ -60,16 +67,20 @@ define i1 @allones32(i8* %p) { define i1 @bytearray7(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_bytearray7_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_bytearray7_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_bytearray7_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_bytearray7_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_bytearray7_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 3 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 61 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_bytearray7_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_bytearray7_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 43 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* @__typeid_bytearray7_byte_array, i64 [[or]] ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]] - ; CHECK-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* @__typeid_bytearray7_bit_mask to i8) + ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* @__typeid_bytearray7_bit_mask to i8) + ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* inttoptr (i64 64 to i8*) to i8) ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0 ; CHECK-NEXT: br label %[[f]] @@ -84,16 +95,20 @@ define i1 @bytearray7(i8* %p) { define i1 @bytearray32(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_bytearray32_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_bytearray32_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_bytearray32_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_bytearray32_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_bytearray32_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 4 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 60 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_bytearray32_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_bytearray32_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 12346 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* @__typeid_bytearray32_byte_array, i64 [[or]] ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]] - ; CHECK-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* @__typeid_bytearray32_bit_mask to i8) + ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* @__typeid_bytearray32_bit_mask to i8) + ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* inttoptr (i64 128 to i8*) to i8) ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0 ; CHECK-NEXT: br label %[[f]] @@ -108,17 +123,21 @@ define i1 @bytearray32(i8* %p) { define i1 @inline5(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_inline5_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_inline5_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_inline5_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_inline5_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_inline5_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 5 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 59 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_inline5_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_inline5_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 31 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: ; CHECK-NEXT: [[trunc:%.*]] = trunc i64 [[or]] to i32 ; CHECK-NEXT: [[and:%.*]] = and i32 [[trunc]], 31 ; CHECK-NEXT: [[shl2:%.*]] = shl i32 1, [[and]] - ; CHECK-NEXT: [[and2:%.*]] = and i32 ptrtoint (i8* @__typeid_inline5_inline_bits to i32), [[shl2]] + ; X86-NEXT: [[and2:%.*]] = and i32 ptrtoint (i8* @__typeid_inline5_inline_bits to i32), [[shl2]] + ; ARM-NEXT: [[and2:%.*]] = and i32 123, [[shl2]] ; CHECK-NEXT: [[ne:%.*]] = icmp ne i32 [[and2]], 0 ; CHECK-NEXT: br label %[[f]] @@ -133,16 +152,20 @@ define i1 @inline5(i8* %p) { define i1 @inline6(i8* %p) { ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (i8* @__typeid_inline6_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_inline6_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_inline6_align to i8)) to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (i8* @__typeid_inline6_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (i8* @__typeid_inline6_align to i8)) to i64) + ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 6 + ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 58 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_inline6_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (i8* @__typeid_inline6_size_m1 to i64) + ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 63 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: ; CHECK-NEXT: [[and:%.*]] = and i64 [[or]], 63 ; CHECK-NEXT: [[shl2:%.*]] = shl i64 1, [[and]] - ; CHECK-NEXT: [[and2:%.*]] = and i64 ptrtoint (i8* @__typeid_inline6_inline_bits to i64), [[shl2]] + ; X86-NEXT: [[and2:%.*]] = and i64 ptrtoint (i8* @__typeid_inline6_inline_bits to i64), [[shl2]] + ; ARM-NEXT: [[and2:%.*]] = and i64 1000000000000, [[shl2]] ; CHECK-NEXT: [[ne:%.*]] = icmp ne i64 [[and2]], 0 ; CHECK-NEXT: br label %[[f]] @@ -162,9 +185,9 @@ define i1 @single(i8* %p) { ret i1 %x } -; CHECK: !0 = !{i64 0, i64 256} -; CHECK: !1 = !{i64 0, i64 64} -; CHECK: !2 = !{i64 -1, i64 -1} -; CHECK: !3 = !{i64 0, i64 32} -; CHECK: !4 = !{i64 0, i64 4294967296} -; CHECK: !5 = !{i64 0, i64 128} +; X86: !0 = !{i64 0, i64 256} +; X86: !1 = !{i64 0, i64 64} +; X86: !2 = !{i64 -1, i64 -1} +; X86: !3 = !{i64 0, i64 32} +; X86: !4 = !{i64 0, i64 4294967296} +; X86: !5 = !{i64 0, i64 128} diff --git a/test/Transforms/LowerTypeTests/simplify.ll b/test/Transforms/LowerTypeTests/simplify.ll index cb5ad4a10bf..12249d9012a 100644 --- a/test/Transforms/LowerTypeTests/simplify.ll +++ b/test/Transforms/LowerTypeTests/simplify.ll @@ -1,6 +1,7 @@ ; RUN: opt -S -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%S/Inputs/import.yaml < %s | FileCheck %s target datalayout = "e-p:64:64" +target triple = "x86_64-unknown-linux" declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone diff --git a/test/Transforms/WholeProgramDevirt/export-single-impl.ll b/test/Transforms/WholeProgramDevirt/export-single-impl.ll index 6c83c30ae28..9b7cf8432f7 100644 --- a/test/Transforms/WholeProgramDevirt/export-single-impl.ll +++ b/test/Transforms/WholeProgramDevirt/export-single-impl.ll @@ -6,6 +6,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: SingleImpl @@ -15,6 +19,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: SingleImpl @@ -24,6 +32,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: SingleImpl @@ -33,6 +45,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: SingleImpl diff --git a/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll b/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll index dbde690ea87..43adb90d69f 100644 --- a/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll +++ b/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll @@ -8,6 +8,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir diff --git a/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll b/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll index 4b1c391b4c4..4260a2e570d 100644 --- a/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll +++ b/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll @@ -8,6 +8,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir @@ -22,6 +26,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir diff --git a/test/Transforms/WholeProgramDevirt/export-vcp.ll b/test/Transforms/WholeProgramDevirt/export-vcp.ll index 9f877fcc0f9..5982ad4ec58 100644 --- a/test/Transforms/WholeProgramDevirt/export-vcp.ll +++ b/test/Transforms/WholeProgramDevirt/export-vcp.ll @@ -11,6 +11,10 @@ target datalayout = "e-p:64:64" ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir @@ -27,6 +31,10 @@ target datalayout = "e-p:64:64" ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir diff --git a/test/Transforms/WholeProgramDevirt/import-indir.ll b/test/Transforms/WholeProgramDevirt/import-indir.ll index 0fece252431..052a3494834 100644 --- a/test/Transforms/WholeProgramDevirt/import-indir.ll +++ b/test/Transforms/WholeProgramDevirt/import-indir.ll @@ -32,6 +32,10 @@ ; SUMMARY-NEXT: TTRes: ; SUMMARY-NEXT: Kind: Unsat ; SUMMARY-NEXT: SizeM1BitWidth: 0 +; SUMMARY-NEXT: AlignLog2: 0 +; SUMMARY-NEXT: SizeM1: 0 +; SUMMARY-NEXT: BitMask: 0 +; SUMMARY-NEXT: InlineBits: 0 ; SUMMARY-NEXT: WPDRes: ; SUMMARY-NEXT: 0: ; SUMMARY-NEXT: Kind: Indir