@@ -701,21 +701,14 @@ void ARMAsmPrinter::emitAttributes() {
701701 ARMBuildAttrs::AddressDirect);
702702 }
703703
704- Metadata *MDEx = nullptr ;
705- Metadata *MDDM = nullptr ;
706- Metadata *MDNM = nullptr ;
707- if (const Module *M = MMI->getModule ()) {
708- MDEx = M->getModuleFlag (" arm-eabi-fp-exceptions" );
709- MDDM = M->getModuleFlag (" arm-eabi-fp-denormal" );
710- MDNM = M->getModuleFlag (" arm-eabi-fp-number-model" );
711- }
712-
713704 // Set FP Denormals.
714- if (auto *DM = mdconst::extract_or_null<ConstantInt>(MDDM))
715- ATS.emitAttribute (ARMBuildAttrs::ABI_FP_denormal, DM->getZExtValue ());
716- else if (checkDenormalAttributeConsistency (*MMI->getModule (),
717- " denormal-fp-math" ,
718- DenormalMode::getPreserveSign ()))
705+ if (auto *DM = mdconst::extract_or_null<ConstantInt>(
706+ MMI->getModule ()->getModuleFlag (" arm-eabi-fp-denormal" ))) {
707+ if (unsigned TagVal = DM->getZExtValue ())
708+ ATS.emitAttribute (ARMBuildAttrs::ABI_FP_denormal, TagVal);
709+ } else if (checkDenormalAttributeConsistency (*MMI->getModule (),
710+ " denormal-fp-math" ,
711+ DenormalMode::getPreserveSign ()))
719712 ATS.emitAttribute (ARMBuildAttrs::ABI_FP_denormal,
720713 ARMBuildAttrs::PreserveFPSign);
721714 else if (checkDenormalAttributeConsistency (*MMI->getModule (),
@@ -755,11 +748,13 @@ void ARMAsmPrinter::emitAttributes() {
755748 }
756749
757750 // Set FP exceptions and rounding
758- if (auto *Ex = mdconst::extract_or_null<ConstantInt>(MDEx))
759- ATS.emitAttribute (ARMBuildAttrs::ABI_FP_exceptions, Ex->getZExtValue ());
760- else if (checkFunctionsAttributeConsistency (*MMI->getModule (),
761- " no-trapping-math" , " true" ) ||
762- TM.Options .NoTrappingFPMath )
751+ if (auto *Ex = mdconst::extract_or_null<ConstantInt>(
752+ MMI->getModule ()->getModuleFlag (" arm-eabi-fp-exceptions" ))) {
753+ if (unsigned TagVal = Ex->getZExtValue ())
754+ ATS.emitAttribute (ARMBuildAttrs::ABI_FP_exceptions, TagVal);
755+ } else if (checkFunctionsAttributeConsistency (*MMI->getModule (),
756+ " no-trapping-math" , " true" ) ||
757+ TM.Options .NoTrappingFPMath )
763758 ATS.emitAttribute (ARMBuildAttrs::ABI_FP_exceptions,
764759 ARMBuildAttrs::Not_Allowed);
765760 else {
@@ -773,9 +768,11 @@ void ARMAsmPrinter::emitAttributes() {
773768
774769 // TM.Options.NoInfsFPMath && TM.Options.NoNaNsFPMath is the
775770 // equivalent of GCC's -ffinite-math-only flag.
776- if (auto *NM = mdconst::extract_or_null<ConstantInt>(MDNM))
777- ATS.emitAttribute (ARMBuildAttrs::ABI_FP_number_model, NM->getZExtValue ());
778- else if (TM.Options .NoInfsFPMath && TM.Options .NoNaNsFPMath )
771+ if (auto *NumModel = mdconst::extract_or_null<ConstantInt>(
772+ MMI->getModule ()->getModuleFlag (" arm-eabi-fp-number-model" ))) {
773+ if (unsigned TagVal = NumModel->getZExtValue ())
774+ ATS.emitAttribute (ARMBuildAttrs::ABI_FP_number_model, TagVal);
775+ } else if (TM.Options .NoInfsFPMath && TM.Options .NoNaNsFPMath )
779776 ATS.emitAttribute (ARMBuildAttrs::ABI_FP_number_model,
780777 ARMBuildAttrs::Allowed);
781778 else
0 commit comments