[PATCH] D130224: [Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 10:41:47 PDT 2022


jdoerfert added a comment.

Generating freeze seems an option, just not sure we can easily get all locations with this approach.
Anyway, some code comments below.



================
Comment at: clang/lib/CodeGen/CGCall.cpp:2061
+    }
+  }
+  return ArgHasMayBeUndefAttr;
----------------
Early exists please.

if (!TargetDecl)
  return false

no ArgHasMayBeUndefAttr is needed, just return true/false, etc.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:4899
+          val = Builder.CreateFreeze(Addr.getPointer());
+        IRCallArgs[FirstIRArg] = val;
 
----------------
Style: `Val`, also below.


================
Comment at: clang/test/CodeGenHIP/maybe_undef-attr-verify.hip:33
+    res = __shfl_sync(t, WARP_SIZE, 0);
+}
----------------
Note, not necessarily to address: I would have preferred auto generated check lines, should not be many and it's easier to see what's going on, IMHO. 


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

https://reviews.llvm.org/D130224



More information about the cfe-commits mailing list