[WebAssembly][GlobalISel] Fix legalizeCustom return value for Helper.lower()#191345
[WebAssembly][GlobalISel] Fix legalizeCustom return value for Helper.lower()#191345
Conversation
…lower() Helper.lower() returns a LegalizerHelper::LegalizeResult enum where UnableToLegalize=2, which implicitly converts to true (success). Compare against LegalizerHelper::Legalized instead so that legalization failures are correctly reported. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@llvm/pr-subscribers-backend-webassembly Author: Jim Lin (tclin914) ChangesHelper.lower() returns a LegalizerHelper::LegalizeResult enum where UnableToLegalize=2, which implicitly converts to true (success). Compare against LegalizerHelper::Legalized instead so that legalization failures are correctly reported. Full diff: https://github.com/llvm/llvm-project/pull/191345.diff 1 Files Affected:
diff --git a/llvm/lib/Target/WebAssembly/GISel/WebAssemblyLegalizerInfo.cpp b/llvm/lib/Target/WebAssembly/GISel/WebAssemblyLegalizerInfo.cpp
index 293ba88605354..a902fcfea6c38 100644
--- a/llvm/lib/Target/WebAssembly/GISel/WebAssemblyLegalizerInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/GISel/WebAssemblyLegalizerInfo.cpp
@@ -90,7 +90,7 @@ bool WebAssemblyLegalizerInfo::legalizeCustom(
return true;
}
- return Helper.lower(MI, 0, DstType);
+ return Helper.lower(MI, 0, DstType) == LegalizerHelper::Legalized;
}
default:
break;
|
|
Wow! Thanks. How'd you notice? Also, shouldn't this be |
…ized Use != UnableToLegalize so that AlreadyLegal is also treated as success, not just Legalized. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updated to != UnableToLegalize. I've been experimenting with AI-assisted code review on recent commits — it flagged the implicit enum-to-bool conversion here where UnableToLegalize=2 converts to true. |
Helper.lower() returns a LegalizerHelper::LegalizeResult enum where UnableToLegalize=2, which implicitly converts to true (success). Compare against LegalizerHelper::Legalized instead so that legalization failures are correctly reported.