[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());
+}
+
+std::string TreePredicateFn::getGISelLeafPredicateCode() const {
+  return PatFragRec->getRecord()
+      ->getValueAsOptionalString("GISelLeafPredicateCode")
+      .value_or(std::string())
----------------
Pierre-vh wrote:

```suggestion
      .value_or(StringRef())
```

https://github.com/llvm/llvm-project/pull/140935


More information about the llvm-commits mailing list