[PATCH] D46030: [TargetInfo] Sort target features before passing them to the backend

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 12:17:34 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL330861: [TargetInfo] Sort target features before passing them to the backend (authored by efriedma, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D46030?vs=143821&id=143984#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46030

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGen/arm-build-attributes.c


Index: cfe/trunk/lib/Basic/Targets.cpp
===================================================================
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -638,6 +638,9 @@
   Opts->Features.clear();
   for (const auto &F : Features)
     Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str());
+  // Sort here, so we handle the features in a predictable order. (This matters
+  // when we're dealing with features that overlap.)
+  llvm::sort(Opts->Features.begin(), Opts->Features.end());
 
   if (!Target->handleTargetFeatures(Opts->Features, Diags))
     return nullptr;
Index: cfe/trunk/test/CodeGen/arm-build-attributes.c
===================================================================
--- cfe/trunk/test/CodeGen/arm-build-attributes.c
+++ cfe/trunk/test/CodeGen/arm-build-attributes.c
@@ -0,0 +1,4 @@
+// RUN: %clang --target=arm-none-eabi -x c - -o - -S < %s -mcpu=cortex-a5 -mfpu=vfpv4-d16 | FileCheck %s
+// REQUIRES: arm-registered-target
+// CHECK: .fpu vfpv4-d16
+void foo() {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46030.143984.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180425/e737794f/attachment.bin>


More information about the llvm-commits mailing list