[PATCH] D24909: fix for not copying fp denormal and trapping options.

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 05:58:23 PDT 2016


hfinkel added a comment.

I'm fine with setting these for consistency, but I don't understand why our failure to do this would cause problems. If you look in lib/CodeGen/CGCall.cpp and you'll see:

  if (!CodeGenOpts.FPDenormalMode.empty())
    FuncAttrs.addAttribute("denormal-fp-math",
                           CodeGenOpts.FPDenormalMode);
  
  FuncAttrs.addAttribute("no-trapping-math",
                         llvm::toStringRef(CodeGenOpts.NoTrappingMath));
  FuncAttrs.addAttribute("no-infs-fp-math",

and the code in TargetMachine::resetTargetOptions in Target/TargetMachine.cpp has this:

  RESET_OPTION(NoTrappingFPMath, "no-trapping-math");
  
  StringRef Denormal =
    F.getFnAttribute("denormal-fp-math").getValueAsString();
  if (Denormal == "ieee")
    Options.FPDenormalType = FPDenormal::IEEE;
  else if (Denormal == "preserve-sign")
    Options.FPDenormalType = FPDenormal::PreserveSign;
  else if (Denormal == "positive-zero")
    Options.FPDenormalType = FPDenormal::PositiveZero;

so this should all work regardless.

Also, please post your patches with full context. Please see http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface for instructions.


https://reviews.llvm.org/D24909





More information about the cfe-commits mailing list