summaryrefslogtreecommitdiff
path: root/lib/Target/NVPTX
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-06-27 02:05:19 +0000
committerEric Christopher <echristo@gmail.com>2014-06-27 02:05:19 +0000
commit04c4efc5932fb4aa1842ff1982b62267f3d53899 (patch)
tree644590c803b62c92cf128046d73c315077b889ae /lib/Target/NVPTX
parent82cb24a385948a7661fd5ebf50f2c3cc72189170 (diff)
downloadllvm-04c4efc5932fb4aa1842ff1982b62267f3d53899.tar.gz
llvm-04c4efc5932fb4aa1842ff1982b62267f3d53899.tar.bz2
llvm-04c4efc5932fb4aa1842ff1982b62267f3d53899.tar.xz
Rework the logic for setting the TargetName. This appears to
be shorter and identical in goal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/NVPTX')
-rw-r--r--lib/Target/NVPTX/NVPTXSubtarget.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/Target/NVPTX/NVPTXSubtarget.cpp b/lib/Target/NVPTX/NVPTXSubtarget.cpp
index 8c7df52be3..2d2a88ab28 100644
--- a/lib/Target/NVPTX/NVPTXSubtarget.cpp
+++ b/lib/Target/NVPTX/NVPTXSubtarget.cpp
@@ -37,18 +37,12 @@ NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
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.