[PATCH] Let llc and opt override "-target-cpu" and "-target-features" using command line options "-mcpu" and "-mattr"

Akira Hatanaka ahatanak at gmail.com
Wed May 6 13:13:15 PDT 2015


Hi echristo, dexonsmith,

llc's options -mcpu and -mattr have no effect if the functions in the IR already have function attributes -target-cpu and -target-features. This is bad for llvm developers as they don't have a convenient way to quickly test different target-cpu and target-features via command line options.

This patch attempts to fix this bug by letting llc and opt rewrite the attributes in the IR. An alternate way would be to pass the cpu and feature strings in TargetOptions but I chose the approach I took in the patch to avoid making changes to TargetOptions and XXXTargetMachine. Also, factored out helper function getCPUFeaturesStr which both opt and llc call.

http://reviews.llvm.org/D9537

Files:
  include/llvm/CodeGen/CommandFlags.h
  include/llvm/IR/Function.h
  lib/IR/Function.cpp
  test/CodeGen/X86/llc-override-mcpu-mattr.ll
  test/Other/opt-override-mcpu-mattr.ll
  test/Transforms/SLPVectorizer/X86/call.ll
  tools/llc/llc.cpp
  tools/opt/opt.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9537.25080.patch
Type: text/x-patch
Size: 10640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150506/79a2fd00/attachment.bin>


More information about the llvm-commits mailing list