[PATCH] D71253: llc/MIR: Fix setFunctionAttributes for MIR functions

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 04:41:08 PST 2019


arsenm created this revision.
arsenm added reviewers: echristo, thegameg, ahatanak, aemerson.
Herald added subscribers: dexonsmith, hiraditya, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.

A random set of attributes are implemented by llc/opt forcing the
string attributes on the IR functions before processing anything. This
would not happen for MIR functions, which have not yet been created at
this point.

      

Use a callback in the MIR parser, purely to avoid dealing with the
ugliness that the command line flags are in a .inc file, and would
require allowing access to these flags from multiple places (either
from the MIR parser directly, or a new utility pass to implement these
flags). It would probably be better to cleanup the flag handling into
a separate library.

      

This is in preparation for treating more command line flags with a
corresponding function attribute in a more uniform way. The fast math
flags in particular have a messy system where the command line flag
sets the behavior from a function attribute if present, and otherwise
the command line flag. This means if any other pass tries to inspect
the function attributes directly, it will be inconsistent with the
intended behavior. This is also inconsistent with the current behavior
of -mcpu and -mattr, which overwrites any pre-existing function
attributes. I would like to move this to consistenly have the command
line flags not overwrite any pre-existing attributes, and to always
ensure the command line flags are consistent with the function
attributes.


https://reviews.llvm.org/D71253

Files:
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/test/CodeGen/MIR/AMDGPU/llc-target-cpu-attr-from-cmdline-ir.mir
  llvm/test/CodeGen/MIR/AMDGPU/llc-target-cpu-attr-from-cmdline.mir
  llvm/tools/llc/llc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71253.233050.patch
Type: text/x-patch
Size: 13627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/cdd7fe4b/attachment.bin>


More information about the llvm-commits mailing list