[PATCH] D142388: [clang] Add builtin_nondet

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 11:04:55 PST 2023


erichkeane added inline comments.


================
Comment at: clang/include/clang/Basic/Builtins.def:658
 BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
+BUILTIN(__builtin_nondet, "v.", "nt")
 
----------------
Not a fan of the name in general, it doesn't really explain what is happening.  Perhaps `__builtin_nondeterministic_value` or something?  

I also wonder if others might have a better name :) 


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3064
+  case Builtin::BI__builtin_nondet: {
+    Value *Result = PoisonValue::get(ConvertType(E->getArg(0)->getType()));
+    Result = Builder.CreateFreeze(Result);
----------------
Is this troublesome with some of the types that have a ConvertTypeForMem?  That is, bool and bool vector types might need a different type/representation? https://clang.llvm.org/doxygen/CodeGenTypes_8cpp_source.html#l00091




================
Comment at: clang/test/CodeGen/builtins-nondet.c:3
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
----------------
Add some examples for 'bool' and vector-bool as well to make sure this is doing what you want.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142388



More information about the cfe-commits mailing list