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/Bitcode/local-type-scope.ll 
llvm/test/DebugInfo/Generic/inlined-local-type.ll 
llvm/test/DebugInfo/Generic/lexical-block-retained-types.ll 
llvm/test/DebugInfo/Generic/lexical-block-types.ll 
llvm/test/DebugInfo/Inputs/cleanup-retained-nodes.ll 
llvm/test/DebugInfo/X86/cleanup-retained-nodes.ll 
llvm/test/DebugInfo/X86/llparser-cleanup-retained-nodes.ll 
llvm/test/DebugInfo/X86/local-type-as-template-parameter.ll 
clang/test/Analysis/analyzeOneFunction.cpp clang/test/DebugInfo/CXX/access.cpp 
clang/test/DebugInfo/CXX/anon-union-vars.cpp 
clang/test/DebugInfo/CXX/codeview-unnamed.cpp 
clang/test/DebugInfo/CXX/gline-tables-only-codeview.cpp 
clang/test/DebugInfo/CXX/lambda-capture-packs.cpp 
clang/test/DebugInfo/CXX/lambda-this.cpp 
clang/test/DebugInfo/Generic/codeview-unnamed.c 
clang/test/DebugInfo/Generic/unused-types.c 
clang/test/DebugInfo/Generic/unused-types.cpp 
llvm/include/llvm/AsmParser/LLParser.h llvm/include/llvm/IR/DIBuilder.h 
llvm/include/llvm/IR/DebugInfoMetadata.h llvm/lib/AsmParser/LLParser.cpp 
llvm/lib/Bitcode/Reader/MetadataLoader.cpp 
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp 
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h 
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/lib/IR/DIBuilder.cpp 
llvm/lib/IR/DebugInfo.cpp llvm/lib/IR/DebugInfoMetadata.cpp 
llvm/lib/IR/Verifier.cpp llvm/lib/Transforms/Utils/CloneFunction.cpp 
llvm/test/Bitcode/upgrade-cu-locals.ll 
llvm/test/CodeGen/ARM/call-graph-section-assembly.ll 
llvm/test/CodeGen/X86/call-graph-section-assembly.ll 
llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll 
llvm/unittests/Transforms/Utils/CloningTest.cpp 
llvm/test/DebugInfo/X86/split-dwarf-local-import.ll 
llvm/test/DebugInfo/X86/split-dwarf-local-import2.ll 
llvm/test/DebugInfo/X86/split-dwarf-local-import3.ll
``````````

</details>


The following files introduce new uses of undef:
 - llvm/test/DebugInfo/X86/split-dwarf-local-import.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/165032
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to