[PATCH] D105841: [Verifier] Check byval/etc type when comparing ABI attributes

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 11:19:58 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1f8d3fd42b7c: [Verifier] Check byval/etc type when comparing ABI attributes (authored by nikic).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105841/new/

https://reviews.llvm.org/D105841

Files:
  llvm/lib/IR/Verifier.cpp
  llvm/test/Verifier/musttail-invalid.ll


Index: llvm/test/Verifier/musttail-invalid.ll
===================================================================
--- llvm/test/Verifier/musttail-invalid.ll
+++ llvm/test/Verifier/musttail-invalid.ll
@@ -46,6 +46,13 @@
   ret void
 }
 
+declare void @mismatched_byval_callee2(ptr byval(i32))
+define void @mismatched_byval2(ptr byval(i64) %a) {
+; CHECK: mismatched ABI impacting function attributes
+  musttail call void @mismatched_byval_callee2(ptr byval(i32) %a)
+  ret void
+}
+
 declare void @mismatched_inreg_callee(i32 inreg)
 define void @mismatched_inreg(i32 %a) {
 ; CHECK: mismatched ABI impacting function attributes
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -3323,8 +3323,9 @@
       Attribute::ByRef};
   AttrBuilder Copy;
   for (auto AK : ABIAttrs) {
-    if (Attrs.hasParamAttribute(I, AK))
-      Copy.addAttribute(AK);
+    Attribute Attr = Attrs.getParamAttributes(I).getAttribute(AK);
+    if (Attr.isValid())
+      Copy.addAttribute(Attr);
   }
 
   // `align` is ABI-affecting only in combination with `byval` or `byref`.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105841.360217.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/92efc8c0/attachment.bin>


More information about the llvm-commits mailing list