From: Eric Christopher Date: Fri, 27 Jun 2014 02:05:19 +0000 (+0000) Subject: Rework the logic for setting the TargetName. This appears to X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8132862a9d037fc8448413c32eaaecad5bbcfc3;p=platform%2Fupstream%2Fllvm.git Rework the logic for setting the TargetName. This appears to be shorter and identical in goal. llvm-svn: 211845 --- diff --git a/llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp b/llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp index 8c7df52..2d2a88a 100644 --- a/llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp +++ b/llvm/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.