diff options
author | Juneyoung Lee <aqjune@gmail.com> | 2024-01-09 23:54:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 23:54:43 -0600 |
commit | 7388b7422f9307dd5ae3fe3876a676d83d702daf (patch) | |
tree | de7e8bdfcbb1610c4b24f693838d1dec9c132893 /llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp | |
parent | c2b57a052daee22cb6401bc7bc514d858ea11eb6 (diff) | |
download | llvm-7388b7422f9307dd5ae3fe3876a676d83d702daf.zip llvm-7388b7422f9307dd5ae3fe3876a676d83d702daf.tar.gz llvm-7388b7422f9307dd5ae3fe3876a676d83d702daf.tar.bz2 |
[WebAssembly] Correctly consider signext/zext arg flags at function declaration (#77281)
This patch fixes WebAssembly's FastISel pass to correctly consider
signext/zeroext parameter flags at function declaration.
Previously, the flags at call sites were only considered during code
generation, which caused an interesting bug report #63388 .
This is problematic especially because in WebAssembly's ABI, either
signext or zeroext can be tagged to a function argument, and it must be
correctly reflected in the generated code. Unit test
https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/WebAssembly/signext-zeroext.ll
shows that `i8 zeroext %t` and `i8 signext %t`'s code gen are different.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index 15dc44a..7f0140a 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -839,9 +839,9 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) { unsigned Reg; - if (Attrs.hasParamAttr(I, Attribute::SExt)) + if (Call->paramHasAttr(I, Attribute::SExt)) Reg = getRegForSignedValue(V); - else if (Attrs.hasParamAttr(I, Attribute::ZExt)) + else if (Call->paramHasAttr(I, Attribute::ZExt)) Reg = getRegForUnsignedValue(V); else Reg = getRegForValue(V); |