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)' 'HEAD~1' HEAD 
llvm/test/ThinLTO/X86/Inputs/reduce-promotion-same-file-local-name.ll 
llvm/test/ThinLTO/X86/reduce-promotion-devirt.ll 
llvm/test/ThinLTO/X86/reduce-promotion-same-file-local-name.ll 
llvm/test/ThinLTO/X86/reduce-promotion-same-local-name.ll 
llvm/test/ThinLTO/X86/reduce-promotion.ll 
clang/test/CodeGen/distributed-thin-lto/cfi-devirt.ll 
clang/test/CodeGen/distributed-thin-lto/cfi.ll 
clang/test/CodeGen/thinlto-funcattr-prop.ll 
lld/test/ELF/lto/comdat-nodeduplicate.ll llvm/include/llvm/AsmParser/LLToken.h 
llvm/include/llvm/IR/ModuleSummaryIndex.h 
llvm/include/llvm/IR/ModuleSummaryIndexYAML.h llvm/include/llvm/LTO/LTO.h 
llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h 
llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h 
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp llvm/lib/AsmParser/LLLexer.cpp 
llvm/lib/AsmParser/LLParser.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
llvm/lib/IR/AsmWriter.cpp llvm/lib/IR/ModuleSummaryIndex.cpp 
llvm/lib/LTO/LTO.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp 
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp 
llvm/test/Assembler/thinlto-memprof-summary.ll 
llvm/test/Assembler/thinlto-multiple-summaries-for-guid.ll 
llvm/test/Assembler/thinlto-summary-visibility.ll 
llvm/test/Assembler/thinlto-summary.ll 
llvm/test/Assembler/thinlto-vtable-summary.ll 
llvm/test/Bitcode/thinlto-alias.ll 
llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll 
llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll 
llvm/test/Bitcode/thinlto-function-summary-refgraph.ll 
llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll 
llvm/test/Bitcode/thinlto-type-tests.ll 
llvm/test/Bitcode/thinlto-type-vcalls.ll llvm/test/ThinLTO/X86/dot-dumper.ll 
llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll 
llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll 
llvm/test/ThinLTO/X86/import_callee_declaration.ll 
llvm/test/ThinLTO/X86/load-store-caching.ll 
llvm/test/Transforms/LowerTypeTests/import-unsat.ll 
llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
``````````

</details>


The following files introduce new uses of undef:
 - llvm/test/ThinLTO/X86/reduce-promotion-devirt.ll

[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/178587
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to