github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {undef deprecator}-->


:warning: undef deprecator found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git diff -U0 --pickaxe-regex -S 
'([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 
ee0ee253d617aa4cddfe5216f93365645579b54d 
3bdbe711b5f937d564e1883ec94e1c5ecbd87750 
clang/test/CodeGen/pfp-attribute-disable.cpp 
clang/test/CodeGen/pfp-load-store.cpp clang/test/CodeGen/pfp-memcpy.cpp 
clang/test/CodeGen/pfp-null-init.cpp clang/test/CodeGen/pfp-struct-gep.cpp 
clang/include/clang/AST/ASTContext.h clang/include/clang/Basic/LangOptions.h 
clang/lib/AST/ASTContext.cpp clang/lib/AST/ExprConstant.cpp 
clang/lib/AST/Type.cpp clang/lib/AST/TypePrinter.cpp 
clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGClass.cpp 
clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CGExprAgg.cpp 
clang/lib/CodeGen/CGExprCXX.cpp clang/lib/CodeGen/CGExprConstant.cpp 
clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/CodeGenFunction.h 
clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h 
clang/lib/CodeGen/ItaniumCXXABI.cpp clang/lib/CodeGen/MicrosoftCXXABI.cpp 
clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Sema/SemaDeclAttr.cpp 
clang/lib/Sema/SemaExprCXX.cpp clang/test/CodeGenCXX/trivial_abi.cpp 
libcxx/include/__functional/function.h libcxx/include/__memory/shared_ptr.h 
libcxx/include/__memory/unique_ptr.h 
libcxx/include/__type_traits/is_trivially_relocatable.h 
libcxx/include/__vector/vector.h 
libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp 
libcxxabi/include/__cxxabi_config.h libcxxabi/src/private_typeinfo.h 
llvm/include/llvm/Analysis/PtrUseVisitor.h 
llvm/include/llvm/Transforms/Utils/Local.h llvm/lib/Analysis/PtrUseVisitor.cpp 
llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp 
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp 
llvm/lib/Transforms/Scalar/SROA.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````

</details>


The following files introduce new uses of undef:
 - clang/lib/CodeGen/CGCall.cpp

[Undef](https://llvm.org/docs/LangRef.html#undefined-values) is now deprecated 
and should only be used in the rare cases where no replacement is possible. For 
example, a load of uninitialized memory yields `undef`. You should use `poison` 
values for placeholders instead.

In tests, avoid using `undef` and having tests that trigger undefined behavior. 
If you need an operand with some unimportant value, you can add a new argument 
to the function and use that instead.

For example, this is considered a bad practice:
```llvm
define void @fn() {
  ...
  br i1 undef, ...
}
```

Please use the following instead:
```llvm
define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}
```

Please refer to the [Undefined Behavior 
Manual](https://llvm.org/docs/UndefinedBehavior.html) for more information.



https://github.com/llvm/llvm-project/pull/133538
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to