[llvm] [GISel][AArch64] Allow PatLeafs to be imported in GISel which were previously causing warnings (PR #140935)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 02:05:24 PDT 2025
================
@@ -1293,8 +1293,21 @@ bool TreePredicateFn::hasGISelPredicateCode() const {
}
std::string TreePredicateFn::getGISelPredicateCode() const {
- return std::string(
- PatFragRec->getRecord()->getValueAsString("GISelPredicateCode"));
+ return PatFragRec->getRecord()->getValueAsString("GISelPredicateCode").str();
+}
+
+bool TreePredicateFn::hasGISelLeafPredicateCode() const {
+ return (!PatFragRec->getRecord()
+ ->getValueAsOptionalString("GISelLeafPredicateCode")
+ .value_or(std::string())
+ .empty());
----------------
Pierre-vh wrote:
```suggestion
.has_value()
```
or just use the `operator bool()`, `std::optional` evaluates to true/false depending on whether there is a value
https://github.com/llvm/llvm-project/pull/140935
More information about the llvm-commits
mailing list