[PATCH] D46410: [Target] Diagnose mismatch in required CPU for always_inline functions

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 3 15:32:54 PDT 2018


craig.topper created this revision.
craig.topper added reviewers: echristo, erichkeane.

If an always inline function requests a different CPU than its caller we should probably error.

If the callee CPU has features that the caller CPU doesn't we would already error for the feature mismatch, but it prints a misleading error about the first feature that mismatches.
If the callee CPU feature list a subset of the caller features we wouldn't error at all.

We also only error right now if the callee as a target attribute, but don't check anything if only the caller has a target attribute. This is consistent with our previous checking behavior, but we might want to fix that. I've left a TODO.

I've simplified some of GetCPUAndFeaturesAttributes since I needed to return the CPU string from getFunctionFeatureMap for the other callers anyway. This also saves us a second parse of the target attribute when adding attributes.


https://reviews.llvm.org/D46410

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  test/CodeGen/target-cpu-error-2.c
  test/CodeGen/target-cpu-error-3.c
  test/CodeGen/target-cpu-error.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46410.145109.patch
Type: text/x-patch
Size: 10725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180503/8d189414/attachment.bin>


More information about the cfe-commits mailing list