<div dir="ltr">ARM backend emits different eabi build attributes based on the ISA variant the target supports or whether certain fast-math options are passed on the command line. For example, these are the attributes that have different values depending on whether -ffast-math is passed to clang:<div><br></div><div>$ clang -target armv7-linux-gnueabi -ffast-math (with -ffast-math)</div><div><br></div><div><div>.eabi_attribute<span class=""> </span>20, 2<span class="">       </span>@ Tag_ABI_FP_denormal<br></div><div>.eabi_attribute<span class="">       </span>23, 1<span class="">       </span>@ Tag_ABI_FP_number_model</div></div><div><br></div><div><div>$ clang -target armv7-linux-gnueabi (without -ffast-math)</div></div><div><br></div><div>.eabi_attribute<span class="">        </span>20, 1<span class="">       </span>@ Tag_ABI_FP_denormal</div><div>.eabi_attribute<span class=""> </span>21, 1<span class="">       </span>@ Tag_ABI_FP_exceptions</div><div>.eabi_attribute<span class="">       </span>23, 3<span class="">       </span>@ Tag_ABI_FP_number_model</div><div><br></div><div>Suppose there are two functions in a module which have different sets of function attributes. One function has attributes for "-ffast-math" (foo1) and the other (foo0) has attributes for "-fno-fast-math". In that case, which set of eabi attributes should ARMAsmPrinter::emitAttributes emit? ARMAsmPrinter::emitAttributes is called once at the start of a file (not once per every function), so I assume it has to merge those attributes which have different values or reject the IR if it discovers incompatibilities.</div>







<div><br></div><div>define double @foo0(double %a) #0 {</div><div>entry:</div><div>  %add = fadd double %a, 1.000000e+00</div><div>  ret double %add</div><div>}</div><div><br></div><div>define double @foo1(double %a) #1 {</div><div>entry:</div><div>  %add = fadd fast double %a, 2.000000e+00</div><div>  ret double %add</div><div>}</div><div>
<p class=""><span class="">







</span></p><p class=""><span class="">attributes #0 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }</span></p><p class=""><span class="">attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" }</span></p><p class=""><span class=""><br></span></p><p class=""><span class=""><br></span></p></div></div>