llvm.org GIT mirror llvm / 1ade907
Bitcode: derive all types used from records instead of Values. There is existing bitcode that we need to support where the structured nature of pointer types is used to derive the result type of some operation. For example a GEP's operation and result will be based on its input Type. When pointers become opaque, the BitcodeReader will still have access to this information because it's explicitly told how to construct the more complex types used, but this information will not be attached to any Value that gets looked up. This changes BitcodeReader so that in all places which use type information in this manner, it's derived from a side-table rather than from the Value in question. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364550 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover a month ago
4 changed file(s) with 315 addition(s) and 148 deletion(s). Raw diff Collapse all Expand all
493493 std::vector GCTable;
494494
495495 std::vector TypeList;
496 DenseMap FunctionTypes;
496497 BitcodeReaderValueList ValueList;
497498 Optional MDLoader;
498499 std::vector ComdatList;
591592 StructType *createIdentifiedStructType(LLVMContext &Context, StringRef Name);
592593 StructType *createIdentifiedStructType(LLVMContext &Context);
593594
594 Type *getTypeByID(unsigned ID);
595
596 Value *getFnValueByID(unsigned ID, Type *Ty) {
595 /// Map all pointer types within \param Ty to the opaque pointer
596 /// type in the same address space if opaque pointers are being
597 /// used, otherwise nop. This converts a bitcode-reader internal
598 /// type into one suitable for use in a Value.
599 Type *flattenPointerTypes(Type *Ty) {
600 return Ty;
601 }
602
603 /// Given a fully structured pointer type (i.e. not opaque), return
604 /// the flattened form of its element, suitable for use in a Value.
605 Type *getPointerElementFlatType(Type *Ty) {
606 return flattenPointerTypes(cast(Ty)->getElementType());
607 }
608
609 /// Given a fully structured pointer type, get its element type in
610 /// both fully structured form, and flattened form suitable for use
611 /// in a Value.
612 std::pair getPointerElementTypes(Type *FullTy) {
613 Type *ElTy = cast(FullTy)->getElementType();
614 return std::make_pair(ElTy, flattenPointerTypes(ElTy));
615 }
616
617 /// Return the flattened type (suitable for use in a Value)
618 /// specified by the given \param ID.
619 Type *getTypeByID(unsigned ID) {
620 return flattenPointerTypes(getFullyStructuredTypeByID(ID));
621 }
622
623 /// Return the fully structured (bitcode-reader internal) type
624 /// corresponding to the given \param ID.
625 Type *getFullyStructuredTypeByID(unsigned ID);
626
627 Value *getFnValueByID(unsigned ID, Type *Ty, Type **FullTy = nullptr) {
597628 if (Ty && Ty->isMetadataTy())
598629 return MetadataAsValue::get(Ty->getContext(), getFnMetadataByID(ID));
599 return ValueList.getValueFwdRef(ID, Ty);
630 return ValueList.getValueFwdRef(ID, Ty, FullTy);
600631 }
601632
602633 Metadata *getFnMetadataByID(unsigned ID) {
618649 /// Increment Slot past the number of slots used in the record. Return true on
619650 /// failure.
620651 bool getValueTypePair(SmallVectorImpl &Record, unsigned &Slot,
621 unsigned InstNum, Value *&ResVal) {
652 unsigned InstNum, Value *&ResVal,
653 Type **FullTy = nullptr) {
622654 if (Slot == Record.size()) return true;
623655 unsigned ValNo = (unsigned)Record[Slot++];
624656 // Adjust the ValNo, if it was encoded relative to the InstNum.
627659 if (ValNo < InstNum) {
628660 // If this is not a forward reference, just return the value we already
629661 // have.
630 ResVal = getFnValueByID(ValNo, nullptr);
662 ResVal = getFnValueByID(ValNo, nullptr, FullTy);
631663 return ResVal == nullptr;
632664 }
633665 if (Slot == Record.size())
635667
636668 unsigned TypeNo = (unsigned)Record[Slot++];
637669 ResVal = getFnValueByID(ValNo, getTypeByID(TypeNo));
670 if (FullTy)
671 *FullTy = getFullyStructuredTypeByID(TypeNo);
638672 return ResVal == nullptr;
639673 }
640674
682716
683717 /// Upgrades old-style typeless byval attributes by adding the corresponding
684718 /// argument's pointee type.
685 void propagateByValTypes(CallBase *CB);
719 void propagateByValTypes(CallBase *CB, ArrayRef ArgsFullTys);
686720
687721 /// Converts alignment exponent (i.e. power of two (or zero)) to the
688722 /// corresponding alignment to use. If alignment is too large, returns
11431177 }
11441178 }
11451179
1146 Type *BitcodeReader::getTypeByID(unsigned ID) {
1180 Type *BitcodeReader::getFullyStructuredTypeByID(unsigned ID) {
11471181 // The type table size is always specified correctly.
11481182 if (ID >= TypeList.size())
11491183 return nullptr;
22672301
22682302 // Read all the records for this value table.
22692303 Type *CurTy = Type::getInt32Ty(Context);
2304 Type *CurFullTy = Type::getInt32Ty(Context);
22702305 unsigned NextCstNo = ValueList.size();
22712306
22722307 while (true) {
23112346 return error("Invalid record");
23122347 if (TypeList[Record[0]] == VoidType)
23132348 return error("Invalid constant type");
2314 CurTy = TypeList[Record[0]];
2349 CurFullTy = TypeList[Record[0]];
2350 CurTy = flattenPointerTypes(CurFullTy);
23152351 continue; // Skip the ValueList manipulation.
23162352 case bitc::CST_CODE_NULL: // NULL
23172353 V = Constant::getNullValue(CurTy);
25302566 InBounds = true;
25312567
25322568 SmallVector Elts;
2569 Type *Elt0FullTy = nullptr;
25332570 while (OpNum != Record.size()) {
2571 if (!Elt0FullTy)
2572 Elt0FullTy = getFullyStructuredTypeByID(Record[OpNum]);
25342573 Type *ElTy = getTypeByID(Record[OpNum++]);
25352574 if (!ElTy)
25362575 return error("Invalid record");
25412580 return error("Invalid gep with no operands");
25422581
25432582 Type *ImplicitPointeeType =
2544 cast(Elts[0]->getType()->getScalarType())
2545 ->getElementType();
2583 getPointerElementFlatType(Elt0FullTy->getScalarType());
25462584 if (!PointeeType)
25472585 PointeeType = ImplicitPointeeType;
25482586 else if (PointeeType != ImplicitPointeeType)
26762714 AsmStr += (char)Record[2+i];
26772715 for (unsigned i = 0; i != ConstStrSize; ++i)
26782716 ConstrStr += (char)Record[3+AsmStrSize+i];
2679 PointerType *PTy = cast(CurTy);
26802717 UpgradeInlineAsmString(&AsmStr);
2681 V = InlineAsm::get(cast(PTy->getElementType()),
2682 AsmStr, ConstrStr, HasSideEffects, IsAlignStack);
2718 V = InlineAsm::get(
2719 cast(getPointerElementFlatType(CurFullTy)), AsmStr,
2720 ConstrStr, HasSideEffects, IsAlignStack);
26832721 break;
26842722 }
26852723 // This version adds support for the asm dialect keywords (e.g.,
27022740 AsmStr += (char)Record[2+i];
27032741 for (unsigned i = 0; i != ConstStrSize; ++i)
27042742 ConstrStr += (char)Record[3+AsmStrSize+i];
2705 PointerType *PTy = cast(CurTy);
27062743 UpgradeInlineAsmString(&AsmStr);
2707 V = InlineAsm::get(cast(PTy->getElementType()),
2708 AsmStr, ConstrStr, HasSideEffects, IsAlignStack,
2709 InlineAsm::AsmDialect(AsmDialect));
2744 V = InlineAsm::get(
2745 cast(getPointerElementFlatType(CurFullTy)), AsmStr,
2746 ConstrStr, HasSideEffects, IsAlignStack,
2747 InlineAsm::AsmDialect(AsmDialect));
27102748 break;
27112749 }
27122750 case bitc::CST_CODE_BLOCKADDRESS:{
27522790 }
27532791 }
27542792
2755 ValueList.assignValue(V, NextCstNo);
2793 assert(V->getType() == flattenPointerTypes(CurFullTy) &&
2794 "Incorrect fully structured type provided for Constant");
2795 ValueList.assignValue(V, NextCstNo, CurFullTy);
27562796 ++NextCstNo;
27572797 }
27582798 }
30253065
30263066 if (Record.size() < 6)
30273067 return error("Invalid record");
3028 Type *Ty = getTypeByID(Record[0]);
3068 Type *FullTy = getFullyStructuredTypeByID(Record[0]);
3069 Type *Ty = flattenPointerTypes(FullTy);
30293070 if (!Ty)
30303071 return error("Invalid record");
30313072 bool isConstant = Record[1] & 1;
30373078 if (!Ty->isPointerTy())
30383079 return error("Invalid type for value");
30393080 AddressSpace = cast(Ty)->getAddressSpace();
3040 Ty = cast(Ty)->getElementType();
3081 std::tie(FullTy, Ty) = getPointerElementTypes(FullTy);
30413082 }
30423083
30433084 uint64_t RawLinkage = Record[3];
30833124 else
30843125 upgradeDLLImportExportLinkage(NewGV, RawLinkage);
30853126
3086 ValueList.push_back(NewGV);
3127 FullTy = PointerType::get(FullTy, AddressSpace);
3128 assert(NewGV->getType() == flattenPointerTypes(FullTy) &&
3129 "Incorrect fully specified type for GlobalVariable");
3130 ValueList.push_back(NewGV, FullTy);
30873131
30883132 // Remember which value to use for the global initializer.
30893133 if (unsigned InitID = Record[2])
31263170
31273171 if (Record.size() < 8)
31283172 return error("Invalid record");
3129 Type *Ty = getTypeByID(Record[0]);
3130 if (!Ty)
3173 Type *FullFTy = getFullyStructuredTypeByID(Record[0]);
3174 Type *FTy = flattenPointerTypes(FullFTy);
3175 if (!FTy)
31313176 return error("Invalid record");
3132 if (auto *PTy = dyn_cast(Ty))
3133 Ty = PTy->getElementType();
3134 auto *FTy = dyn_cast(Ty);
3135 if (!FTy)
3177 if (isa(FTy))
3178 std::tie(FullFTy, FTy) = getPointerElementTypes(FullFTy);
3179
3180 if (!isa(FTy))
31363181 return error("Invalid type for value");
31373182 auto CC = static_cast(Record[1]);
31383183 if (CC & ~CallingConv::MaxID)
31423187 if (Record.size() > 16)
31433188 AddrSpace = Record[16];
31443189
3145 Function *Func = Function::Create(FTy, GlobalValue::ExternalLinkage,
3146 AddrSpace, Name, TheModule);
3190 Function *Func =
3191 Function::Create(cast(FTy), GlobalValue::ExternalLinkage,
3192 AddrSpace, Name, TheModule);
3193
3194 assert(Func->getFunctionType() == flattenPointerTypes(FullFTy) &&
3195 "Incorrect fully specified type provided for function");
3196 FunctionTypes[Func] = cast(FullFTy);
31473197
31483198 Func->setCallingConv(CC);
31493199 bool isProto = Record[2];
31543204 // Upgrade any old-style byval without a type by propagating the argument's
31553205 // pointee type. There should be no opaque pointers where the byval type is
31563206 // implicit.
3157 for (auto &Arg : Func->args()) {
3158 if (Arg.hasByValAttr() &&
3159 !Arg.getAttribute(Attribute::ByVal).getValueAsType()) {
3160 Arg.removeAttr(Attribute::ByVal);
3161 Arg.addAttr(Attribute::getWithByValType(
3162 Context, Arg.getType()->getPointerElementType()));
3163 }
3207 for (unsigned i = 0; i != Func->arg_size(); ++i) {
3208 if (!Func->hasParamAttribute(i, Attribute::ByVal))
3209 continue;
3210
3211 Type *PTy = cast(FullFTy)->getParamType(i);
3212 Func->removeParamAttr(i, Attribute::ByVal);
3213 Func->addParamAttr(i, Attribute::getWithByValType(
3214 Context, getPointerElementFlatType(PTy)));
31643215 }
31653216
31663217 unsigned Alignment;
32203271 if (Record.size() > 18)
32213272 Func->setPartition(StringRef(Strtab.data() + Record[17], Record[18]));
32223273
3223 ValueList.push_back(Func);
3274 Type *FullTy = PointerType::get(FullFTy, AddrSpace);
3275 assert(Func->getType() == flattenPointerTypes(FullTy) &&
3276 "Incorrect fully specified type provided for Function");
3277 ValueList.push_back(Func, FullTy);
32243278
32253279 // If this is a function with a body, remember the prototype we are
32263280 // creating now, so that we can match up the body with them later.
32493303 if (Record.size() < (3 + (unsigned)NewRecord))
32503304 return error("Invalid record");
32513305 unsigned OpNum = 0;
3252 Type *Ty = getTypeByID(Record[OpNum++]);
3306 Type *FullTy = getFullyStructuredTypeByID(Record[OpNum++]);
3307 Type *Ty = flattenPointerTypes(FullTy);
32533308 if (!Ty)
32543309 return error("Invalid record");
32553310
32583313 auto *PTy = dyn_cast(Ty);
32593314 if (!PTy)
32603315 return error("Invalid type for value");
3261 Ty = PTy->getElementType();
3316 std::tie(FullTy, Ty) = getPointerElementTypes(FullTy);
32623317 AddrSpace = PTy->getAddressSpace();
32633318 } else {
32643319 AddrSpace = Record[OpNum++];
32743329 else
32753330 NewGA = GlobalIFunc::create(Ty, AddrSpace, getDecodedLinkage(Linkage), Name,
32763331 nullptr, TheModule);
3332
3333 assert(NewGA->getValueType() == flattenPointerTypes(FullTy) &&
3334 "Incorrect fully structured type provided for GlobalIndirectSymbol");
32773335 // Old bitcode files didn't have visibility field.
32783336 // Local linkage must have default visibility.
32793337 if (OpNum != Record.size()) {
33043362 OpNum += 2;
33053363 }
33063364
3307 ValueList.push_back(NewGA);
3365 FullTy = PointerType::get(FullTy, AddrSpace);
3366 assert(NewGA->getType() == flattenPointerTypes(FullTy) &&
3367 "Incorrect fully structured type provided for GlobalIndirectSymbol");
3368 ValueList.push_back(NewGA, FullTy);
33083369 IndirectSymbolInits.push_back(std::make_pair(NewGA, Val));
33093370 return Error::success();
33103371 }
35823643 return Error::success();
35833644 }
35843645
3585 void BitcodeReader::propagateByValTypes(CallBase *CB) {
3586 for (unsigned i = 0; i < CB->getNumArgOperands(); ++i) {
3587 if (CB->paramHasAttr(i, Attribute::ByVal) &&
3588 !CB->getAttribute(i, Attribute::ByVal).getValueAsType()) {
3589 CB->removeParamAttr(i, Attribute::ByVal);
3590 CB->addParamAttr(
3591 i, Attribute::getWithByValType(
3592 Context,
3593 CB->getArgOperand(i)->getType()->getPointerElementType()));
3594 }
3646 void BitcodeReader::propagateByValTypes(CallBase *CB,
3647 ArrayRef ArgsFullTys) {
3648 for (unsigned i = 0; i != CB->arg_size(); ++i) {
3649 if (!CB->paramHasAttr(i, Attribute::ByVal))
3650 continue;
3651
3652 CB->removeParamAttr(i, Attribute::ByVal);
3653 CB->addParamAttr(
3654 i, Attribute::getWithByValType(
3655 Context, getPointerElementFlatType(ArgsFullTys[i])));
35953656 }
35963657 }
35973658
36093670 unsigned ModuleMDLoaderSize = MDLoader->size();
36103671
36113672 // Add all the function arguments to the value table.
3612 for (Argument &I : F->args())
3613 ValueList.push_back(&I);
3614
3673 unsigned ArgNo = 0;
3674 FunctionType *FullFTy = FunctionTypes[F];
3675 for (Argument &I : F->args()) {
3676 assert(I.getType() == flattenPointerTypes(FullFTy->getParamType(ArgNo)) &&
3677 "Incorrect fully specified type for Function Argument");
3678 ValueList.push_back(&I, FullFTy->getParamType(ArgNo++));
3679 }
36153680 unsigned NextValueNo = ValueList.size();
36163681 BasicBlock *CurBB = nullptr;
36173682 unsigned CurBBNo = 0;
36833748 // Read a record.
36843749 Record.clear();
36853750 Instruction *I = nullptr;
3751 Type *FullTy = nullptr;
36863752 Expected MaybeBitCode = Stream.readRecord(Entry.ID, Record);
36873753 if (!MaybeBitCode)
36883754 return MaybeBitCode.takeError();
38273893 OpNum+2 != Record.size())
38283894 return error("Invalid record");
38293895
3830 Type *ResTy = getTypeByID(Record[OpNum]);
3896 FullTy = getFullyStructuredTypeByID(Record[OpNum]);
3897 Type *ResTy = flattenPointerTypes(FullTy);
38313898 int Opc = getDecodedCastOpcode(Record[OpNum + 1]);
38323899 if (Opc == -1 || !ResTy)
38333900 return error("Invalid record");
38563923
38573924 if (BitCode == bitc::FUNC_CODE_INST_GEP) {
38583925 InBounds = Record[OpNum++];
3859 Ty = getTypeByID(Record[OpNum++]);
3926 FullTy = getFullyStructuredTypeByID(Record[OpNum++]);
3927 Ty = flattenPointerTypes(FullTy);
38603928 } else {
38613929 InBounds = BitCode == bitc::FUNC_CODE_INST_INBOUNDS_GEP_OLD;
38623930 Ty = nullptr;
38633931 }
38643932
38653933 Value *BasePtr;
3866 if (getValueTypePair(Record, OpNum, NextValueNo, BasePtr))
3867 return error("Invalid record");
3868
3869 if (!Ty)
3870 Ty = cast(BasePtr->getType()->getScalarType())
3871 ->getElementType();
3872 else if (Ty !=
3873 cast(BasePtr->getType()->getScalarType())
3874 ->getElementType())
3934 Type *FullBaseTy = nullptr;
3935 if (getValueTypePair(Record, OpNum, NextValueNo, BasePtr, &FullBaseTy))
3936 return error("Invalid record");
3937
3938 if (!Ty) {
3939 std::tie(FullTy, Ty) =
3940 getPointerElementTypes(FullBaseTy->getScalarType());
3941 } else if (Ty != getPointerElementFlatType(FullBaseTy->getScalarType()))
38753942 return error(
38763943 "Explicit gep type does not match pointee type of pointer operand");
38773944
38843951 }
38853952
38863953 I = GetElementPtrInst::Create(Ty, BasePtr, GEPIdx);
3954 FullTy = GetElementPtrInst::getGEPReturnType(FullTy, I, GEPIdx);
38873955
38883956 InstructionList.push_back(I);
38893957 if (InBounds)
38953963 // EXTRACTVAL: [opty, opval, n x indices]
38963964 unsigned OpNum = 0;
38973965 Value *Agg;
3898 if (getValueTypePair(Record, OpNum, NextValueNo, Agg))
3966 if (getValueTypePair(Record, OpNum, NextValueNo, Agg, &FullTy))
38993967 return error("Invalid record");
39003968
39013969 unsigned RecSize = Record.size();
39033971 return error("EXTRACTVAL: Invalid instruction with 0 indices");
39043972
39053973 SmallVector EXTRACTVALIdx;
3906 Type *CurTy = Agg->getType();
39073974 for (; OpNum != RecSize; ++OpNum) {
3908 bool IsArray = CurTy->isArrayTy();
3909 bool IsStruct = CurTy->isStructTy();
3975 bool IsArray = FullTy->isArrayTy();
3976 bool IsStruct = FullTy->isStructTy();
39103977 uint64_t Index = Record[OpNum];
39113978
39123979 if (!IsStruct && !IsArray)
39133980 return error("EXTRACTVAL: Invalid type");
39143981 if ((unsigned)Index != Index)
39153982 return error("Invalid value");
3916 if (IsStruct && Index >= CurTy->getStructNumElements())
3983 if (IsStruct && Index >= FullTy->getStructNumElements())
39173984 return error("EXTRACTVAL: Invalid struct index");
3918 if (IsArray && Index >= CurTy->getArrayNumElements())
3985 if (IsArray && Index >= FullTy->getArrayNumElements())
39193986 return error("EXTRACTVAL: Invalid array index");
39203987 EXTRACTVALIdx.push_back((unsigned)Index);
39213988
39223989 if (IsStruct)
3923 CurTy = CurTy->getStructElementType(Index);
3990 FullTy = FullTy->getStructElementType(Index);
39243991 else
3925 CurTy = CurTy->getArrayElementType();
3992 FullTy = FullTy->getArrayElementType();
39263993 }
39273994
39283995 I = ExtractValueInst::Create(Agg, EXTRACTVALIdx);
39344001 // INSERTVAL: [opty, opval, opty, opval, n x indices]
39354002 unsigned OpNum = 0;
39364003 Value *Agg;
3937 if (getValueTypePair(Record, OpNum, NextValueNo, Agg))
4004 if (getValueTypePair(Record, OpNum, NextValueNo, Agg, &FullTy))
39384005 return error("Invalid record");
39394006 Value *Val;
39404007 if (getValueTypePair(Record, OpNum, NextValueNo, Val))
39804047 // handles select i1 ... in old bitcode
39814048 unsigned OpNum = 0;
39824049 Value *TrueVal, *FalseVal, *Cond;
3983 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
4050 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal, &FullTy) ||
39844051 popValue(Record, OpNum, NextValueNo, TrueVal->getType(), FalseVal) ||
39854052 popValue(Record, OpNum, NextValueNo, Type::getInt1Ty(Context), Cond))
39864053 return error("Invalid record");
39954062 // handles select i1 or select [N x i1]
39964063 unsigned OpNum = 0;
39974064 Value *TrueVal, *FalseVal, *Cond;
3998 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
4065 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal, &FullTy) ||
39994066 popValue(Record, OpNum, NextValueNo, TrueVal->getType(), FalseVal) ||
40004067 getValueTypePair(Record, OpNum, NextValueNo, Cond))
40014068 return error("Invalid record");
40254092 case bitc::FUNC_CODE_INST_EXTRACTELT: { // EXTRACTELT: [opty, opval, opval]
40264093 unsigned OpNum = 0;
40274094 Value *Vec, *Idx;
4028 if (getValueTypePair(Record, OpNum, NextValueNo, Vec) ||
4095 if (getValueTypePair(Record, OpNum, NextValueNo, Vec, &FullTy) ||
40294096 getValueTypePair(Record, OpNum, NextValueNo, Idx))
40304097 return error("Invalid record");
40314098 if (!Vec->getType()->isVectorTy())
40324099 return error("Invalid type for value");
40334100 I = ExtractElementInst::Create(Vec, Idx);
4101 FullTy = FullTy->getVectorElementType();
40344102 InstructionList.push_back(I);
40354103 break;
40364104 }
40384106 case bitc::FUNC_CODE_INST_INSERTELT: { // INSERTELT: [ty, opval,opval,opval]
40394107 unsigned OpNum = 0;
40404108 Value *Vec, *Elt, *Idx;
4041 if (getValueTypePair(Record, OpNum, NextValueNo, Vec))
4109 if (getValueTypePair(Record, OpNum, NextValueNo, Vec, &FullTy))
40424110 return error("Invalid record");
40434111 if (!Vec->getType()->isVectorTy())
40444112 return error("Invalid type for value");
40544122 case bitc::FUNC_CODE_INST_SHUFFLEVEC: {// SHUFFLEVEC: [opval,ty,opval,opval]
40554123 unsigned OpNum = 0;
40564124 Value *Vec1, *Vec2, *Mask;
4057 if (getValueTypePair(Record, OpNum, NextValueNo, Vec1) ||
4125 if (getValueTypePair(Record, OpNum, NextValueNo, Vec1, &FullTy) ||
40584126 popValue(Record, OpNum, NextValueNo, Vec1->getType(), Vec2))
40594127 return error("Invalid record");
40604128
40634131 if (!Vec1->getType()->isVectorTy() || !Vec2->getType()->isVectorTy())
40644132 return error("Invalid type for value");
40654133 I = new ShuffleVectorInst(Vec1, Vec2, Mask);
4134 FullTy = VectorType::get(FullTy->getVectorElementType(),
4135 Mask->getType()->getVectorNumElements());
40664136 InstructionList.push_back(I);
40674137 break;
40684138 }
43664436 BasicBlock *UnwindBB = getBasicBlock(Record[OpNum++]);
43674437
43684438 FunctionType *FTy = nullptr;
4369 if (CCInfo >> 13 & 1 &&
4370 !(FTy = dyn_cast(getTypeByID(Record[OpNum++]))))
4371 return error("Explicit invoke type is not a function type");
4439 FunctionType *FullFTy = nullptr;
4440 if ((CCInfo >> 13) & 1) {
4441 FullFTy =
4442 dyn_cast(getFullyStructuredTypeByID(Record[OpNum++]));
4443 if (!FullFTy)
4444 return error("Explicit invoke type is not a function type");
4445 FTy = cast(flattenPointerTypes(FullFTy));
4446 }
43724447
43734448 Value *Callee;
4374 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
4449 if (getValueTypePair(Record, OpNum, NextValueNo, Callee, &FullTy))
43754450 return error("Invalid record");
43764451
43774452 PointerType *CalleeTy = dyn_cast(Callee->getType());
43784453 if (!CalleeTy)
43794454 return error("Callee is not a pointer");
43804455 if (!FTy) {
4381 FTy = dyn_cast(CalleeTy->getElementType());
4382 if (!FTy)
4456 FullFTy =
4457 dyn_cast(cast(FullTy)->getElementType());
4458 if (!FullFTy)
43834459 return error("Callee is not of pointer to function type");
4384 } else if (CalleeTy->getElementType() != FTy)
4460 FTy = cast(flattenPointerTypes(FullFTy));
4461 } else if (getPointerElementFlatType(FullTy) != FTy)
43854462 return error("Explicit invoke type does not match pointee type of "
43864463 "callee operand");
43874464 if (Record.size() < FTy->getNumParams() + OpNum)
43884465 return error("Insufficient operands to call");
43894466
43904467 SmallVector Ops;
4468 SmallVector ArgsFullTys;
43914469 for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i, ++OpNum) {
43924470 Ops.push_back(getValue(Record, OpNum, NextValueNo,
43934471 FTy->getParamType(i)));
4472 ArgsFullTys.push_back(FullFTy->getParamType(i));
43944473 if (!Ops.back())
43954474 return error("Invalid record");
43964475 }
44024481 // Read type/value pairs for varargs params.
44034482 while (OpNum != Record.size()) {
44044483 Value *Op;
4405 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
4484 Type *FullTy;
4485 if (getValueTypePair(Record, OpNum, NextValueNo, Op, &FullTy))
44064486 return error("Invalid record");
44074487 Ops.push_back(Op);
4488 ArgsFullTys.push_back(FullTy);
44084489 }
44094490 }
44104491
44114492 I = InvokeInst::Create(FTy, Callee, NormalBB, UnwindBB, Ops,
44124493 OperandBundles);
4494 FullTy = FullFTy->getReturnType();
44134495 OperandBundles.clear();
44144496 InstructionList.push_back(I);
44154497 cast(I)->setCallingConv(
44164498 static_cast(CallingConv::MaxID & CCInfo));
44174499 cast(I)->setAttributes(PAL);
4418 propagateByValTypes(cast(I));
4500 propagateByValTypes(cast(I), ArgsFullTys);
44194501
44204502 break;
44214503 }
44414523 IndirectDests.push_back(getBasicBlock(Record[OpNum++]));
44424524
44434525 FunctionType *FTy = nullptr;
4444 if (CCInfo >> bitc::CALL_EXPLICIT_TYPE & 1 &&
4445 !(FTy = dyn_cast(getTypeByID(Record[OpNum++]))))
4446 return error("Explicit call type is not a function type");
4526 FunctionType *FullFTy = nullptr;
4527 if ((CCInfo >> bitc::CALL_EXPLICIT_TYPE) & 1) {
4528 FullFTy =
4529 dyn_cast(getFullyStructuredTypeByID(Record[OpNum++]));
4530 if (!FullFTy)
4531 return error("Explicit call type is not a function type");
4532 FTy = cast(flattenPointerTypes(FullFTy));
4533 }
44474534
44484535 Value *Callee;
4449 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
4536 if (getValueTypePair(Record, OpNum, NextValueNo, Callee, &FullTy))
44504537 return error("Invalid record");
44514538
44524539 PointerType *OpTy = dyn_cast(Callee->getType());
44534540 if (!OpTy)
44544541 return error("Callee is not a pointer type");
44554542 if (!FTy) {
4456 FTy = dyn_cast(OpTy->getElementType());
4457 if (!FTy)
4543 FullFTy =
4544 dyn_cast(cast(FullTy)->getElementType());
4545 if (!FullFTy)
44584546 return error("Callee is not of pointer to function type");
4459 } else if (OpTy->getElementType() != FTy)
4547 FTy = cast(flattenPointerTypes(FullFTy));
4548 } else if (getPointerElementFlatType(FullTy) != FTy)
44604549 return error("Explicit call type does not match pointee type of "
44614550 "callee operand");
44624551 if (Record.size() < FTy->getNumParams() + OpNum)
44894578
44904579 I = CallBrInst::Create(FTy, Callee, DefaultDest, IndirectDests, Args,
44914580 OperandBundles);
4581 FullTy = FullFTy->getReturnType();
44924582 OperandBundles.clear();
44934583 InstructionList.push_back(I);
44944584 cast(I)->setCallingConv(
45034593 case bitc::FUNC_CODE_INST_PHI: { // PHI: [ty, val0,bb0, ...]
45044594 if (Record.size() < 1 || ((Record.size()-1)&1))
45054595 return error("Invalid record");
4506 Type *Ty = getTypeByID(Record[0]);
4596 FullTy = getFullyStructuredTypeByID(Record[0]);
4597 Type *Ty = flattenPointerTypes(FullTy);
45074598 if (!Ty)
45084599 return error("Invalid record");
45094600
45404631 if (Record.size() < 4)
45414632 return error("Invalid record");
45424633 }
4543 Type *Ty = getTypeByID(Record[Idx++]);
4634 FullTy = getFullyStructuredTypeByID(Record[Idx++]);
4635 Type *Ty = flattenPointerTypes(FullTy);
45444636 if (!Ty)
45454637 return error("Invalid record");
45464638 if (BitCode == bitc::FUNC_CODE_INST_LANDINGPAD_OLD) {
45934685 SwiftErrorMask;
45944686 bool InAlloca = AlignRecord & InAllocaMask;
45954687 bool SwiftError = AlignRecord & SwiftErrorMask;
4596 Type *Ty = getTypeByID(Record[0]);
4688 FullTy = getFullyStructuredTypeByID(Record[0]);
4689 Type *Ty = flattenPointerTypes(FullTy);
45974690 if ((AlignRecord & ExplicitTypeMask) == 0) {
45984691 auto *PTy = dyn_cast_or_null(Ty);
45994692 if (!PTy)
46004693 return error("Old-style alloca with a non-pointer type");
4601 Ty = PTy->getElementType();
4694 std::tie(FullTy, Ty) = getPointerElementTypes(FullTy);
46024695 }
46034696 Type *OpTy = getTypeByID(Record[1]);
46044697 Value *Size = getFnValueByID(Record[2], OpTy);
46174710 AI->setUsedWithInAlloca(InAlloca);
46184711 AI->setSwiftError(SwiftError);
46194712 I = AI;
4713 FullTy = PointerType::get(FullTy, AS);
46204714 InstructionList.push_back(I);
46214715 break;
46224716 }
46234717 case bitc::FUNC_CODE_INST_LOAD: { // LOAD: [opty, op, align, vol]
46244718 unsigned OpNum = 0;
46254719 Value *Op;
4626 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
4720 if (getValueTypePair(Record, OpNum, NextValueNo, Op, &FullTy) ||
46274721 (OpNum + 2 != Record.size() && OpNum + 3 != Record.size()))
46284722 return error("Invalid record");
46294723
4724 if (!isa(Op->getType()))
4725 return error("Load operand is not a pointer type");
4726
46304727 Type *Ty = nullptr;
4631 if (OpNum + 3 == Record.size())
4632 Ty = getTypeByID(Record[OpNum++]);
4728 if (OpNum + 3 == Record.size()) {
4729 FullTy = getFullyStructuredTypeByID(Record[OpNum++]);
4730 Ty = flattenPointerTypes(FullTy);
4731 } else
4732 std::tie(FullTy, Ty) = getPointerElementTypes(FullTy);
4733
46334734 if (Error Err = typeCheckLoadStoreInst(Ty, Op->getType()))
46344735 return Err;
4635 if (!Ty)
4636 Ty = cast(Op->getType())->getElementType();
46374736
46384737 unsigned Align;
46394738 if (Error Err = parseAlignmentValue(Record[OpNum], Align))
46404739 return Err;
46414740 I = new LoadInst(Ty, Op, "", Record[OpNum + 1], Align);
4642
46434741 InstructionList.push_back(I);
46444742 break;
46454743 }
46474745 // LOADATOMIC: [opty, op, align, vol, ordering, ssid]
46484746 unsigned OpNum = 0;
46494747 Value *Op;
4650 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
4748 if (getValueTypePair(Record, OpNum, NextValueNo, Op, &FullTy) ||
46514749 (OpNum + 4 != Record.size() && OpNum + 5 != Record.size()))
46524750 return error("Invalid record");
46534751
4752 if (!isa(Op->getType()))
4753 return error("Load operand is not a pointer type");
4754
46544755 Type *Ty = nullptr;
4655 if (OpNum + 5 == Record.size())
4656 Ty = getTypeByID(Record[OpNum++]);
4756 if (OpNum + 5 == Record.size()) {
4757 FullTy = getFullyStructuredTypeByID(Record[OpNum++]);
4758 Ty = flattenPointerTypes(FullTy);
4759 } else
4760 std::tie(FullTy, Ty) = getPointerElementTypes(FullTy);
4761
46574762 if (Error Err = typeCheckLoadStoreInst(Ty, Op->getType()))
46584763 return Err;
4659 if (!Ty)
4660 Ty = cast(Op->getType())->getElementType();
46614764
46624765 AtomicOrdering Ordering = getDecodedOrdering(Record[OpNum + 2]);
46634766 if (Ordering == AtomicOrdering::NotAtomic ||
46724775 if (Error Err = parseAlignmentValue(Record[OpNum], Align))
46734776 return Err;
46744777 I = new LoadInst(Ty, Op, "", Record[OpNum + 1], Align, Ordering, SSID);
4675
46764778 InstructionList.push_back(I);
46774779 break;
46784780 }
46804782 case bitc::FUNC_CODE_INST_STORE_OLD: { // STORE2:[ptrty, ptr, val, align, vol]
46814783 unsigned OpNum = 0;
46824784 Value *Val, *Ptr;
4683 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
4785 Type *FullTy;
4786 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr, &FullTy) ||
46844787 (BitCode == bitc::FUNC_CODE_INST_STORE
46854788 ? getValueTypePair(Record, OpNum, NextValueNo, Val)
46864789 : popValue(Record, OpNum, NextValueNo,
4687 cast(Ptr->getType())->getElementType(),
4688 Val)) ||
4790 getPointerElementFlatType(FullTy), Val)) ||
46894791 OpNum + 2 != Record.size())
46904792 return error("Invalid record");
46914793
47034805 // STOREATOMIC: [ptrty, ptr, val, align, vol, ordering, ssid]
47044806 unsigned OpNum = 0;
47054807 Value *Val, *Ptr;
4706 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
4808 Type *FullTy;
4809 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr, &FullTy) ||
47074810 !isa(Ptr->getType()) ||
47084811 (BitCode == bitc::FUNC_CODE_INST_STOREATOMIC
47094812 ? getValueTypePair(Record, OpNum, NextValueNo, Val)
47104813 : popValue(Record, OpNum, NextValueNo,
4711 cast(Ptr->getType())->getElementType(),
4712 Val)) ||
4814 getPointerElementFlatType(FullTy), Val)) ||
47134815 OpNum + 4 != Record.size())
47144816 return error("Invalid record");
47154817
47374839 // failureordering?, isweak?]
47384840 unsigned OpNum = 0;
47394841 Value *Ptr, *Cmp, *New;
4740 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
4741 (BitCode == bitc::FUNC_CODE_INST_CMPXCHG
4742 ? getValueTypePair(Record, OpNum, NextValueNo, Cmp)
4743 : popValue(Record, OpNum, NextValueNo,
4744 cast(Ptr->getType())->getElementType(),
4745 Cmp)) ||
4746 popValue(Record, OpNum, NextValueNo, Cmp->getType(), New) ||
4842 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr, &FullTy))
4843 return error("Invalid record");
4844
4845 if (!isa(Ptr->getType()))
4846 return error("Cmpxchg operand is not a pointer type");
4847
4848 if (BitCode == bitc::FUNC_CODE_INST_CMPXCHG) {
4849 if (getValueTypePair(Record, OpNum, NextValueNo, Cmp, &FullTy))
4850 return error("Invalid record");
4851 } else if (popValue(Record, OpNum, NextValueNo,
4852 getPointerElementFlatType(FullTy), Cmp))
4853 return error("Invalid record");
4854 else
4855 FullTy = cast(FullTy)->getElementType();
4856
4857 if (popValue(Record, OpNum, NextValueNo, Cmp->getType(), New) ||
47474858 Record.size() < OpNum + 3 || Record.size() > OpNum + 5)
47484859 return error("Invalid record");
4860
47494861 AtomicOrdering SuccessOrdering = getDecodedOrdering(Record[OpNum + 1]);
47504862 if (SuccessOrdering == AtomicOrdering::NotAtomic ||
47514863 SuccessOrdering == AtomicOrdering::Unordered)
47634875
47644876 I = new AtomicCmpXchgInst(Ptr, Cmp, New, SuccessOrdering, FailureOrdering,
47654877 SSID);
4878 FullTy = StructType::get(Context, {FullTy, Type::getInt1Ty(Context)});
47664879 cast(I)->setVolatile(Record[OpNum]);
47674880
47684881 if (Record.size() < 8) {
47714884 // expecting the first component of a modern cmpxchg.
47724885 CurBB->getInstList().push_back(I);
47734886 I = ExtractValueInst::Create(I, 0);
4887 FullTy = cast(FullTy)->getElementType(0);
47744888 } else {
47754889 cast(I)->setWeak(Record[OpNum+4]);
47764890 }
47824896 // ATOMICRMW:[ptrty, ptr, val, op, vol, ordering, ssid]
47834897 unsigned OpNum = 0;
47844898 Value *Ptr, *Val;
4785 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
4899 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr, &FullTy) ||
47864900 !isa(Ptr->getType()) ||
47874901 popValue(Record, OpNum, NextValueNo,
4788 cast(Ptr->getType())->getElementType(), Val) ||
4789 OpNum+4 != Record.size())
4902 getPointerElementFlatType(FullTy), Val) ||
4903 OpNum + 4 != Record.size())
47904904 return error("Invalid record");
47914905 AtomicRMWInst::BinOp Operation = getDecodedRMWOperation(Record[OpNum]);
47924906 if (Operation < AtomicRMWInst::FIRST_BINOP ||
47984912 return error("Invalid record");
47994913 SyncScope::ID SSID = getDecodedSyncScopeID(Record[OpNum + 3]);
48004914 I = new AtomicRMWInst(Operation, Ptr, Val, Ordering, SSID);
4915 FullTy = getPointerElementFlatType(FullTy);
48014916 cast(I)->setVolatile(Record[OpNum+1]);
48024917 InstructionList.push_back(I);
48034918 break;
48324947 }
48334948
48344949 FunctionType *FTy = nullptr;
4835 if (CCInfo >> bitc::CALL_EXPLICIT_TYPE & 1 &&
4836 !(FTy = dyn_cast(getTypeByID(Record[OpNum++]))))
4837 return error("Explicit call type is not a function type");
4950 FunctionType *FullFTy = nullptr;
4951 if ((CCInfo >> bitc::CALL_EXPLICIT_TYPE) & 1) {
4952 FullFTy =
4953 dyn_cast(getFullyStructuredTypeByID(Record[OpNum++]));
4954 if (!FullFTy)
4955 return error("Explicit call type is not a function type");
4956 FTy = cast(flattenPointerTypes(FullFTy));
4957 }
48384958
48394959 Value *Callee;
4840 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
4960 if (getValueTypePair(Record, OpNum, NextValueNo, Callee, &FullTy))
48414961 return error("Invalid record");
48424962
48434963 PointerType *OpTy = dyn_cast(Callee->getType());
48444964 if (!OpTy)
48454965 return error("Callee is not a pointer type");
48464966 if (!FTy) {
4847 FTy = dyn_cast(OpTy->getElementType());
4848 if (!FTy)
4967 FullFTy =
4968 dyn_cast(cast(FullTy)->getElementType());
4969 if (!FullFTy)
48494970 return error("Callee is not of pointer to function type");
4850 } else if (OpTy->getElementType() != FTy)
4971 FTy = cast(flattenPointerTypes(FullFTy));
4972 } else if (getPointerElementFlatType(FullTy) != FTy)
48514973 return error("Explicit call type does not match pointee type of "
48524974 "callee operand");
48534975 if (Record.size() < FTy->getNumParams() + OpNum)
48544976 return error("Insufficient operands to call");
48554977
48564978 SmallVector Args;
4979 SmallVector ArgsFullTys;
48574980 // Read the fixed params.
48584981 for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i, ++OpNum) {
48594982 if (FTy->getParamType(i)->isLabelTy())
48614984 else
48624985 Args.push_back(getValue(Record, OpNum, NextValueNo,
48634986 FTy->getParamType(i)));
4987 ArgsFullTys.push_back(FullFTy->getParamType(i));
48644988 if (!Args.back())
48654989 return error("Invalid record");
48664990 }
48724996 } else {
48734997 while (OpNum != Record.size()) {
48744998 Value *Op;
4875 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
4999 Type *FullTy;
5000 if (getValueTypePair(Record, OpNum, NextValueNo, Op, &FullTy))
48765001 return error("Invalid record");
48775002 Args.push_back(Op);
5003 ArgsFullTys.push_back(FullTy);
48785004 }
48795005 }
48805006
48815007 I = CallInst::Create(FTy, Callee, Args, OperandBundles);
5008 FullTy = FullFTy->getReturnType();
48825009 OperandBundles.clear();
48835010 InstructionList.push_back(I);
48845011 cast(I)->setCallingConv(
48925019 TCK = CallInst::TCK_NoTail;
48935020 cast(I)->setTailCallKind(TCK);
48945021 cast(I)->setAttributes(PAL);
4895 propagateByValTypes(cast(I));
5022 propagateByValTypes(cast(I), ArgsFullTys);
48965023 if (FMF.any()) {
48975024 if (!isa(I))
48985025 return error("Fast-math-flags specified for call without "
49065033 return error("Invalid record");
49075034 Type *OpTy = getTypeByID(Record[0]);
49085035 Value *Op = getValue(Record, 1, NextValueNo, OpTy);
4909 Type *ResTy = getTypeByID(Record[2]);
5036 FullTy = getFullyStructuredTypeByID(Record[2]);
5037 Type *ResTy = flattenPointerTypes(FullTy);
49105038 if (!OpTy || !Op || !ResTy)
49115039 return error("Invalid record");
49125040 I = new VAArgInst(Op, ResTy);
49565084 }
49575085
49585086 // Non-void values get registered in the value table for future use.
4959 if (I && !I->getType()->isVoidTy())
4960 ValueList.assignValue(I, NextValueNo++);
5087 if (I && !I->getType()->isVoidTy()) {
5088 if (!FullTy) {
5089 FullTy = I->getType();
5090 assert(
5091 !FullTy->isPointerTy() && !isa(FullTy) &&
5092 !isa(FullTy) &&
5093 (!isa(FullTy) ||
5094 FullTy->getVectorElementType()->isFloatingPointTy() ||
5095 FullTy->getVectorElementType()->isIntegerTy()) &&
5096 "Structured types must be assigned with corresponding non-opaque "
5097 "pointer type");
5098 }
5099
5100 assert(I->getType() == flattenPointerTypes(FullTy) &&
5101 "Incorrect fully structured type provided for Instruction");
5102 ValueList.assignValue(I, NextValueNo++, FullTy);
5103 }
49615104 }
49625105
49635106 OutOfRecordLoop:
6464
6565 } // end namespace llvm
6666
67 void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx) {
67 void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx, Type *FullTy) {
6868 if (Idx == size()) {
69 push_back(V);
69 push_back(V, FullTy);
7070 return;
7171 }
7272
7373 if (Idx >= size())
7474 resize(Idx + 1);
75
76 assert(FullTypes[Idx] == nullptr || FullTypes[Idx] == FullTy);
77 FullTypes[Idx] = FullTy;
7578
7679 WeakTrackingVH &OldV = ValuePtrs[Idx];
7780 if (!OldV) {
108111 return C;
109112 }
110113
111 Value *BitcodeReaderValueList::getValueFwdRef(unsigned Idx, Type *Ty) {
114 Value *BitcodeReaderValueList::getValueFwdRef(unsigned Idx, Type *Ty,
115 Type **FullTy) {
112116 // Bail out for a clearly invalid value. This would make us call resize(0)
113117 if (Idx == std::numeric_limits::max())
114118 return nullptr;
120124 // If the types don't match, it's invalid.
121125 if (Ty && Ty != V->getType())
122126 return nullptr;
127 if (FullTy)
128 *FullTy = FullTypes[Idx];
123129 return V;
124130 }
125131
2727 class BitcodeReaderValueList {
2828 std::vector ValuePtrs;
2929
30 /// Struct containing fully-specified copies of the type of each
31 /// value. When pointers are opaque, this will be contain non-opaque
32 /// variants so that restructuring instructions can determine their
33 /// type correctly even if being loaded from old bitcode where some
34 /// types are implicit.
35 std::vector FullTypes;
36
3037 /// As we resolve forward-referenced constants, we add information about them
3138 /// to this vector. This allows us to resolve them in bulk instead of
3239 /// resolving each reference at a time. See the code in
4754
4855 // vector compatibility methods
4956 unsigned size() const { return ValuePtrs.size(); }
50 void resize(unsigned N) { ValuePtrs.resize(N); }
51 void push_back(Value *V) { ValuePtrs.emplace_back(V); }
57 void resize(unsigned N) {
58 ValuePtrs.resize(N);
59 FullTypes.resize(N);
60 }
61 void push_back(Value *V, Type *Ty) {
62 ValuePtrs.emplace_back(V);
63 FullTypes.emplace_back(Ty);
64 }
5265
5366 void clear() {
5467 assert(ResolveConstants.empty() && "Constants not resolved?");
5568 ValuePtrs.clear();
69 FullTypes.clear();
5670 }
5771
5872 Value *operator[](unsigned i) const {
6175 }
6276
6377 Value *back() const { return ValuePtrs.back(); }
64 void pop_back() { ValuePtrs.pop_back(); }
78 void pop_back() {
79 ValuePtrs.pop_back();
80 FullTypes.pop_back();
81 }
6582 bool empty() const { return ValuePtrs.empty(); }
6683
6784 void shrinkTo(unsigned N) {
6885 assert(N <= size() && "Invalid shrinkTo request!");
6986 ValuePtrs.resize(N);
87 FullTypes.resize(N);
7088 }
7189
7290 Constant *getConstantFwdRef(unsigned Idx, Type *Ty);
73 Value *getValueFwdRef(unsigned Idx, Type *Ty);
91 Value *getValueFwdRef(unsigned Idx, Type *Ty, Type **FullTy = nullptr);
7492
75 void assignValue(Value *V, unsigned Idx);
93 void assignValue(Value *V, unsigned Idx, Type *FullTy);
7694
7795 /// Once all constants are read, this method bulk resolves any forward
7896 /// references.
133133 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-pointer-type.bc 2>&1 | \
134134 RUN: FileCheck --check-prefix=LOAD-BAD-TYPE %s
135135
136 LOAD-BAD-TYPE: Load/Store operand is not a pointer type
136 LOAD-BAD-TYPE: Load operand is not a pointer type
137137
138138 RUN: not llvm-dis -disable-output %p/Inputs/invalid-GCTable-overflow.bc 2>&1 | \
139139 RUN: FileCheck --check-prefix=GCTABLE-OFLOW %s