[PATCH] D134410: [clang][CodeGen] Add noundef metadata to load instructions (preliminary)

John McIver via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 14:19:25 PDT 2022


jmciver added inline comments.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:1746
 
+  if (auto TyPtr = Ty.getTypePtrOrNull()) {
+    if (!(TyPtr->isSpecificBuiltinType(BuiltinType::UChar) ||
----------------
vitalybuka wrote:
> Taking into account potantial risks from pre-existing UB, I believe we need clang switch to be able to shutdown this branch, similar to enable_noundef_analysis.
> User with large code bases maybe need some time for transition.
> 
> I have no opinion if this should be ON or OFF by default
A flag is a good idea; I'll go ahead and add that. We can determine the default later, for now I would like to default to `on` to see/show the effects. Anyone feel free to let me know if you have reasoning otherwise.

For the flag name: `enable_noundef_loads`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134410



More information about the cfe-commits mailing list