[llvm] [IR] Do not set `none` for function uwtable (PR #93387)

Joshua Cao via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 16:43:12 PDT 2024


================
@@ -526,13 +526,9 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
 
   if (hasAttribute(Attribute::UWTable)) {
     UWTableKind Kind = getUWTableKind();
-    if (Kind != UWTableKind::None) {
-      return Kind == UWTableKind::Default
-                 ? "uwtable"
-                 : ("uwtable(" +
-                    Twine(Kind == UWTableKind::Sync ? "sync" : "async") + ")")
-                       .str();
-    }
+    assert(Kind != UWTableKind::None &&
----------------
caojoshua wrote:

I'm not sure if the `Kind` is always expected to not be `UWTableKind::None`, but the current code seems to make that assumption. If it is None, we fall through to the [llvm_unreachable at the bottom of the function](https://github.com/llvm/llvm-project/blob/c87a7b3bdb673747f2242ba2edc7d5b2f5b53c30/llvm/lib/IR/Attributes.cpp#L643).

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


More information about the llvm-commits mailing list