about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-28 22:18:13 +0000
committerbors <bors@rust-lang.org>2018-03-28 22:18:13 +0000
commitd52c44ea8df9f9045e6059cb2d37df743be50bb1 (patch)
treec23ef9f643221d7f4b1869f7a681248cff99f304 /src/rustllvm/PassWrapper.cpp
parente5277c1457d397f22ba18a1d40c1318729becbb4 (diff)
parent30560bb99a8875560bbad9030715520b8300110c (diff)
downloadrust-d52c44ea8df9f9045e6059cb2d37df743be50bb1.tar.gz
rust-d52c44ea8df9f9045e6059cb2d37df743be50bb1.zip
Auto merge of #49460 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests

- Successful merges: #49243, #49329, #49364, #49400, #49405, #49427, #49428, #49429, #49439, #49442, #49444, #49452
- Failed merges:
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
-rw-r--r--src/rustllvm/PassWrapper.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 3d5cce81278..382ef2cc407 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -205,17 +205,13 @@ GEN_SUBTARGETS
 
 extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM,
                                    const char *Feature) {
-#if LLVM_RUSTLLVM
+#if LLVM_VERSION_GE(6, 0)
   TargetMachine *Target = unwrap(TM);
   const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
-  const FeatureBitset &Bits = MCInfo->getFeatureBits();
-  const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
-
-  for (auto &FeatureEntry : FeatTable)
-    if (!strcmp(FeatureEntry.Key, Feature))
-      return (Bits & FeatureEntry.Value) == FeatureEntry.Value;
-#endif
+  return MCInfo->checkFeatures(std::string("+") + Feature);
+#else
   return false;
+#endif
 }
 
 enum class LLVMRustCodeModel {