Fix ARMSubtarget feature parsing.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 30 Jun 2011 02:12:44 +0000 (02:12 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 30 Jun 2011 02:12:44 +0000 (02:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134129 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMSubtarget.cpp

index cf67497d9442f00977811d608d33b8f41d0e3dc2..694b31385b27a3c6dfc533c56fe16491dd745200 100644 (file)
@@ -120,17 +120,14 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &CPU,
   if (TT.find("eabi") != std::string::npos)
     TargetABI = ARM_ABI_AAPCS;
 
-  // Parse features string.  If the first entry in FS (the CPU) is missing,
-  // insert the architecture feature derived from the target triple.  This is
-  // important for setting features that are implied based on the architecture
-  // version.
-  std::string FSWithArch;
-  if (FS.empty())
-    FSWithArch = std::string(ARMArchFeature);
-  else if (FS.find(',') == 0)
-    FSWithArch = std::string(ARMArchFeature) + FS;
-  else
+  // Insert the architecture feature derived from the target triple into the
+  // feature string. This is important for setting features that are implied
+  // based on the architecture version.
+  std::string FSWithArch = std::string(ARMArchFeature);
+  if (FSWithArch.empty())
     FSWithArch = FS;
+  else if (!FS.empty())
+    FSWithArch = FSWithArch + "," + FS;
   ParseSubtargetFeatures(FSWithArch, CPUString);
 
   // After parsing Itineraries, set ItinData.IssueWidth.