[llvm] r211845 - Rework the logic for setting the TargetName. This appears to
Eric Christopher
echristo at gmail.com
Thu Jun 26 19:05:19 PDT 2014
Author: echristo
Date: Thu Jun 26 21:05:19 2014
New Revision: 211845
URL: http://llvm.org/viewvc/llvm-project?rev=211845&view=rev
Log:
Rework the logic for setting the TargetName. This appears to
be shorter and identical in goal.
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXSubtarget.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXSubtarget.cpp?rev=211845&r1=211844&r2=211845&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXSubtarget.cpp Thu Jun 26 21:05:19 2014
@@ -37,18 +37,12 @@ NVPTXSubtarget::NVPTXSubtarget(const std
else
drvInterface = NVPTX::CUDA;
- // Provide the default CPU if none
- std::string defCPU = "sm_20";
-
- ParseSubtargetFeatures((CPU.empty() ? defCPU : CPU), FS);
-
- // Get the TargetName from the FS if available
- if (FS.empty() && CPU.empty())
- TargetName = defCPU;
- else if (!CPU.empty())
- TargetName = CPU;
- else
+ // Provide the default CPU if we don't have one.
+ if (CPU.empty() && FS.size())
llvm_unreachable("we are not using FeatureStr");
+ TargetName = CPU.empty() ? "sm_20" : CPU;
+
+ ParseSubtargetFeatures(TargetName, FS);
// We default to PTX 3.1, but we cannot just default to it in the initializer
// since the attribute parser checks if the given option is >= the default.
More information about the llvm-commits
mailing list