Skip to content

Commit 6149b17

Browse files
committed
Address Medhi's and Tobias' comments
1 parent d49b0db commit 6149b17

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,19 @@ TargetFeaturesAttr TargetFeaturesAttr::featuresAt(Operation *op) {
375375
}
376376

377377
FailureOr<Attribute> TargetFeaturesAttr::query(DataLayoutEntryKey key) {
378-
if (auto stringKey = dyn_cast<StringAttr>(key)) {
379-
if (contains(stringKey))
380-
return UnitAttr::get(getContext());
378+
auto stringKey = dyn_cast<StringAttr>(key);
379+
if (!stringKey)
380+
return failure();
381381

382-
if (contains((std::string("+") + stringKey.strref()).str()))
383-
return BoolAttr::get(getContext(), true);
382+
if (contains(stringKey))
383+
return UnitAttr::get(getContext());
384+
385+
if (contains((std::string("+") + stringKey.strref()).str()))
386+
return BoolAttr::get(getContext(), true);
387+
388+
if (contains((std::string("-") + stringKey.strref()).str()))
389+
return BoolAttr::get(getContext(), false);
384390

385-
if (contains((std::string("-") + stringKey.strref()).str()))
386-
return BoolAttr::get(getContext(), false);
387-
}
388391
return failure();
389392
}
390393

mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
89
#include "mlir/Target/LLVMIR/Transforms/Passes.h"
910

1011
#include "mlir/Dialect/DLTI/DLTI.h"

mlir/test/Target/LLVMIR/target-to-target-features-dlti-query.mlir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module attributes {transform.with_named_sequence} {
2525
}
2626
}
2727

28-
2928
// -----
3029

3130
// Check that newer processor features, like AMX, are appropriated derived and queryable.

0 commit comments

Comments
 (0)