This is subsequent patch of https://reviews.llvm.org/D70116.
This is one of patches for enabling LTO support in RISCV, in some time LTO code generator will handle below case with -mabi=ilp32f, it's similar to llc example.c -mtriple=riscv32 -mabi=ilp32f.
define float @foo(i32 %a) nounwind #0 { ... } attributes #0 = { "target-features"="+f"}
- at this moment we assume one compilation unit only have same abi.
- The target-features is per function attribute, and the original checking is at
too early stage so backned can't get the function attribute at that times.
so I think maybe moving the checking to RISCVTargetLowering is a good idea.
- if users don't specific -mattr, the default target-feature come from IR attribute.
- fix https://reviews.llvm.org/D70116 failed case
I'm not sure we should be using errs() here directly, should we perhaps be using report_fatal_error here?