[PATCH] D62319: IR: add 'byval(<ty>)' variant to 'byval' function parameters

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 16:45:12 PDT 2019

dblaikie added a comment.

Generally looking pretty good to me.

Comment at: llvm/include/llvm/IR/Argument.h:81
+  /// If this is a byval argument, return its size.
+  Type *getParamByValType() const;
Comment looks to be out of date (speaks of returning the size, rather than type)

Comment at: llvm/lib/IR/Attributes.cpp:394-395
+    Result += "byval";
+    Type *Ty = getValueAsType();
+    if (Ty) {
+      raw_string_ostream OS(Result);
You can roll the declaration into the condition if you like - pretty common in the LLVM codebase, though not a stylistic requirement by any means.

Comment at: llvm/lib/IR/Attributes.cpp:554
+      if (getKindAsEnum() == AI.getKindAsEnum())
+        return getValueAsType() < AI.getValueAsType();
+      return getKindAsEnum() < AI.getKindAsEnum();
This being pointer ordering - that means it'll be unstable across runs (which I assume/think none of the other attributes are?) - is that OK?(I don't know if that's OK - it probably is OK)

Comment at: llvm/test/Assembler/invalid-size1.ll:1-4
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+; CHECK: error: expected function name
+declare i8* size 4 @ret_size()
Leftover from the previous version?



More information about the llvm-commits mailing list