[PATCH] D99080: Normalize usage of StrBoolAttr

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 09:14:53 PDT 2021


serge-sans-paille added a comment.

Thanks @nikic for pointing me in the assert direction; i've been prting without much trouble all exisiting test to use the form proposed in this review, and I'm now in an interesting situation; What if the following code:

   define double @unsafe_fp_math_off(double %x) {
    %div = fdiv double %x, 2.0
    ret double %div
  }

gets compiled without extra flag? There's no unsafe math flag anywhere, so it's indeed a div. If I add the attribute `"unsafe-fp-math"` I get a mul, and that's fine.

If I compiler this code with `-enable-unsafe-fp-math` from `llc`, it's equivalent to having the `"unsafe-fp-math"`, and that's fine too. But then with current design, there's no way to *force* that function into safe mode, whatever the CLI passed to `llc`.

Stated otherwise, having three states for a str bool attribute indeed has one quality: the attribute can be in the *unset* state, where CLI argument can prevail.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99080/new/

https://reviews.llvm.org/D99080



More information about the llvm-commits mailing list