]> granicus.if.org Git - llvm/commitdiff
LowerTypeTests: Add import/export support for targets without absolute symbol constants.
authorPeter Collingbourne <peter@pcc.me.uk>
Mon, 11 Sep 2017 22:49:10 +0000 (22:49 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Mon, 11 Sep 2017 22:49:10 +0000 (22:49 +0000)
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

16 files changed:
include/llvm/IR/ModuleSummaryIndex.h
include/llvm/IR/ModuleSummaryIndexYAML.h
lib/LTO/LTO.cpp
lib/Transforms/IPO/LowerTypeTests.cpp
test/Transforms/LowerTypeTests/Inputs/import.yaml
test/Transforms/LowerTypeTests/export-allones.ll
test/Transforms/LowerTypeTests/export-bytearray.ll
test/Transforms/LowerTypeTests/export-icall.ll
test/Transforms/LowerTypeTests/export-inline.ll
test/Transforms/LowerTypeTests/import.ll
test/Transforms/LowerTypeTests/simplify.ll
test/Transforms/WholeProgramDevirt/export-single-impl.ll
test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
test/Transforms/WholeProgramDevirt/export-vcp.ll
test/Transforms/WholeProgramDevirt/import-indir.ll

index 7e3492545b62e63647e59811f8353942ec81e4c2..242233ece4be2eb7e9f2b0e118e60a77363b7207 100644 (file)
@@ -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 {
index a287eb399fe9ea4a24b126a4a6320d8ed8ef6007..2f9990ca03d8541051898ef54081da92c7591953 100644 (file)
@@ -30,6 +30,10 @@ template <> struct MappingTraits<TypeTestResolution> {
   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);
   }
 };
 
index a13170cf8add291f5d48eb7a4938364cfa9abbb3..fad6d5ca0063a9389a9bda96790f47a2ac16d9b6 100644 (file)
@@ -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);
index 79424edb14c660990d8b1886c85ca5fa1e578a2f..49cc14c5b59202b9f8735ae3bd833f6cbc1255e1 100644 (file)
@@ -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<ConstantInt>(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<ConstantInt>(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<GlobalVariable>(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<GlobalVariable>(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<IntegerType>(Ty) ? Ty : Int64Ty, Const);
+      if (!isa<IntegerType>(Ty))
+        C = ConstantExpr::getIntToPtr(C, Ty);
+      return C;
+    }
+
+    Constant *C = ImportGlobal(Name);
+    auto *GV = cast<GlobalVariable>(C->stripPointerCasts());
+    if (isa<IntegerType>(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<MDString>(TypeId)->getString(), TIL);
+    if (TIUI.IsExported) {
+      uint8_t *MaskPtr = exportTypeId(cast<MDString>(TypeId)->getString(), TIL);
+      if (BAI)
+        BAI->MaskPtr = MaskPtr;
+    }
 
     // Lower each call to llvm.type.test for this type identifier.
     for (CallInst *CI : TIUI.CallSites) {
index d4a5c2c3c2550a9eb4e8c7451aa5ec21bad2287b..7a57d8c4f255ac5fdbb6b04c4cf0977c98b4edbf 100644 (file)
@@ -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
index a642ec87355f56b35176aaf8995f14878f44d90b..00af10449dfd9a2869dc3e494814636371e6f37b 100644 (file)
@@ -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
 
 ; 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)
 
 ; 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:
index 7565b85df30f07ad830b2042f09b5f7e5485e566..aa06a8d56612f2e0313e21ada761e6cc47945892 100644 (file)
@@ -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
 
 ; 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)
 ; 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:
index 0a1af66883c4ebd12a8d64fdb29d90240b47c645..ccbb07aec37a4ab720700a00113dac76d69d7194 100644 (file)
@@ -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:
index 1da5866e88cc1a4b969d819fc48d0c6c9ec105df..54e0d42c33c568e3e51326033184f6164912a5e8 100644 (file)
@@ -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
 
 ; 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)
 
 ; 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:
index 1a5aceccd631b243c08f946a607c97d629dea18c..f397fa7c7b87e9c141f267fd58d3280486b1477a 100644 (file)
@@ -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}
index cb5ad4a10bfbd6a36c33283e443dabd1c6a9545e..12249d9012ab8e13ba16f8f10f7ba70d15aa2f5a 100644 (file)
@@ -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
 
index 6c83c30ae28edd37a8b1b6c7c87473217631f443..9b7cf8432f746b70eba17e53af8427ae7b4c5b63 100644 (file)
@@ -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
 ; 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
 ; 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
 ; 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
index dbde690ea878ba35ecf44c6481d5d4195d586743..43adb90d69f1c22f823593c9b42385de7b45ec9d 100644 (file)
@@ -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
index 4b1c391b4c4fe35d168a6e6e49b57807d69bb5dc..4260a2e570d16a49d63ba412483e8a2bc6cebe5c 100644 (file)
@@ -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
 ; 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
index 9f877fcc0f93ab2c8d5870e14b1b73a83dcac3e0..5982ad4ec58f1d9fccd2df198bc85311e094a389 100644 (file)
@@ -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
index 0fece252431568247d72430f1e76ff2ae4f7e61b..052a3494834330353c4ba258774bced077a3dd93 100644 (file)
 ; 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