This is an archive of the discontinued LLVM Phabricator instance.

fix for not copying fp denormal and trapping options.
AbandonedPublic

Authored by SjoerdMeijer on Sep 26 2016, 5:18 AM.

Details

Summary

This is a fix for not copying fp denormal and trapping options, and depends on the nfc cleanups in D24906 and D24907.

Diff Detail

Event Timeline

SjoerdMeijer retitled this revision from to fix for not copying fp denormal and trapping options..
SjoerdMeijer updated this object.
SjoerdMeijer added a subscriber: cfe-commits.
hfinkel added a subscriber: hfinkel.Oct 3 2016, 5:58 AM

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.

Hi Hal,
Thanks for reviewing and you're right: this should work. We actually have actually some downstream (aarch64) build attribute selection code that would work better with this change. Are you okay with committing this change?
Cheers,
Sjoerd.

Hi Hal,
Thanks for reviewing and you're right: this should work. We actually have actually some downstream (aarch64) build attribute selection code that would work better with this change. Are you okay with committing this change?
Cheers,
Sjoerd.

Can you explain what you mean? What does this code do?

My general impression is that we're planning to rip out this code entirely and reply only on setting the functions attributes. @echristo, am I right about this?

echristo edited edge metadata.Oct 3 2016, 4:47 PM

Yes, none of this should be added or expanded in TargetOptions.

Thanks!

-eric

SjoerdMeijer abandoned this revision.Oct 4 2016, 1:02 AM

Ok, thanks for the feedback and looking into this. I will abandon this change.
To still answer your question, there is nothing more to it than emitting an AArch64 build attribute symbol (for library selection). This done based on function attributes and options. But I've now noticed that this (downstream) logic needs updating. Thanks again.