@@ -555,8 +555,6 @@ static AttributeSet getIntrinsicFnAttributeSet(LLVMContext &C, unsigned ID) {
555555 default: llvm_unreachable("Invalid attribute set number");)" ;
556556
557557 for (const CodeGenIntrinsic &Int : Ints) {
558- if (!hasFnAttributes (Int))
559- continue ;
560558 unsigned ID = UniqFnAttributes.size ();
561559 if (!UniqFnAttributes.try_emplace (&Int, ID).second )
562560 continue ;
@@ -606,8 +604,7 @@ static AttributeSet getIntrinsicFnAttributeSet(LLVMContext &C, unsigned ID) {
606604 }
607605} // getIntrinsicFnAttributeSet
608606
609- AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
610- )" ;
607+ static constexpr uint16_t IntrinsicsToAttributesMap[] = {)" ;
611608
612609 // Compute the maximum number of attribute arguments and the map. For function
613610 // attributes, we only consider whether the intrinsics has any function
@@ -619,6 +616,14 @@ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
619616 UniqAttributes.try_emplace (&Int, ID);
620617 }
621618
619+ // Emit an array of AttributeList. Most intrinsics will have at least one
620+ // entry, for the function itself (index ~1), which is usually nounwind.
621+ for (const CodeGenIntrinsic &Int : Ints) {
622+ uint16_t FnAttrIndex = UniqFnAttributes[&Int];
623+ OS << formatv (" \n {} << 8 | {}, // {}" , FnAttrIndex,
624+ UniqAttributes[&Int], Int.Name );
625+ }
626+
622627 // Assign a 16-bit packed ID for each intrinsic. The lower 8-bits will be its
623628 // "argument attribute ID" (index in UniqAttributes) and upper 8 bits will be
624629 // its "function attribute ID" (index in UniqFnAttributes).
@@ -627,17 +632,12 @@ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {
627632 if (UniqFnAttributes.size () > 256 )
628633 PrintFatalError (" Too many unique function attributes for table!" );
629634
630- // Emit an array of AttributeList. Most intrinsics will have at least one
631- // entry, for the function itself (index ~1), which is usually nounwind.
632- OS << " static constexpr uint16_t IntrinsicsToAttributesMap[] = {" ;
633- for (const CodeGenIntrinsic &Int : Ints) {
634- uint16_t FnAttrIndex = hasFnAttributes (Int) ? UniqFnAttributes[&Int] : 0 ;
635- OS << formatv (" \n {} << 8 | {}, // {}" , FnAttrIndex,
636- UniqAttributes[&Int], Int.Name );
637- }
635+ OS << R"(
636+ };
637+
638+ AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {)" ;
638639
639640 OS << formatv (R"(
640- };
641641 if (id == 0)
642642 return AttributeList();
643643
0 commit comments