SuccessChanges

Summary

  1. [StaticAnalyzer] Support struct annotations in FuchsiaHandleChecker (details)
  2. [llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref (details)
  3. thinlto_embed_bitcode.ll: clarify grep should treat input as text (details)
  4. [SelectionDAG] Remove unused declaration ExpandStrictFPOp (NFC) (details)
  5. [MachineLICM] Remove unused declaration HoistRegion (details)
  6. Add Semantic check for Flang OpenMP 4.5 - 2.15.3.2 and 2.15.3.3 shared and private clause (details)
  7. [MBP] Remove unused declaration shouldPredBlockBeOutlined (NFC) (details)
  8. [PowerPC] Extend folding RLWINM + RLWINM to post-RA. (details)
Commit 914f6c4ff8a42d384cad0bbb07de4dd1a96c78d4 by haowei
[StaticAnalyzer] Support struct annotations in FuchsiaHandleChecker

Support adding handle annotations to sturucture that contains
handles. All the handles referenced by the structure (direct
value or ptr) would be treated as containing the
release/use/acquire annotations directly.

Patch by Yu Shan

Differential Revision: https://reviews.llvm.org/D91223
The file was modifiedclang/test/Analysis/fuchsia_handle.cpp
The file was modifiedclang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
Commit 1756d67934bb5fe3b12bdb5fa55d61f61bd70bc5 by i
[llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref

All these potential null pointer dereferences are reported by my static analyzer for null smart pointer dereferences, which has a different implementation from `alpha.cplusplus.SmartPtr`.

The checked pointers in this patch are initialized by Target::createXXX functions. When the creator function pointer is not correctly set, a null pointer will be returned, or the creator function may originally return a null pointer.

Some of them may not make sense as they may be checked before entering the function, but I fixed them all in this patch. I submit this fix because 1) similar checks are found in some other places in the LLVM codebase for the same return value of the function; and, 2) some of the pointers are dereferenced before they are checked, which may definitely trigger a null pointer dereference if the return value is nullptr.

Reviewed By: tejohnson, MaskRay, jpienaar

Differential Revision: https://reviews.llvm.org/D91410
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
The file was modifiedllvm/tools/llvm-exegesis/llvm-exegesis.cpp
The file was modifiedllvm/lib/LTO/LTOModule.cpp
The file was modifiedllvm/tools/llvm-mc/llvm-mc.cpp
The file was modifiedllvm/lib/CodeGen/LLVMTargetMachine.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
The file was modifiedllvm/tools/llvm-exegesis/lib/LlvmState.cpp
The file was modifiedclang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
The file was modifiedllvm/tools/llvm-ml/llvm-ml.cpp
The file was modifiedllvm/lib/LTO/LTOCodeGenerator.cpp
The file was modifiedllvm/lib/LTO/ThinLTOCodeGenerator.cpp
The file was modifiedmlir/lib/ExecutionEngine/ExecutionEngine.cpp
The file was modifiedllvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
The file was modifiedmlir/lib/Conversion/GPUCommon/ConvertKernelFuncToBlob.cpp
The file was modifiedllvm/tools/llvm-objdump/MachODump.cpp
The file was modifiedclang/tools/driver/cc1as_main.cpp
The file was modifiedllvm/lib/CodeGen/ParallelCG.cpp
The file was modifiedllvm/lib/LTO/LTOBackend.cpp
The file was modifiedllvm/tools/llvm-mca/llvm-mca.cpp
Commit 2482648a795afbe12774168bbbf70dc14c031267 by mtrofin
thinlto_embed_bitcode.ll: clarify grep should treat input as text

The input to the test's use of grep should be treated as text, and
that's not the case on certain Linux distros. Added --text.
The file was modifiedclang/test/CodeGen/thinlto_embed_bitcode.ll
Commit c2309ff3d50c27cea4b338affb6fd6168c792f0e by kazu
[SelectionDAG] Remove unused declaration ExpandStrictFPOp (NFC)

ExpandStrictFPOp started taking two parameters instead of one on Jan
10, 2020 in commit f678fc7660b36ce0ad6ce4f05eaa28f3e9fdedb5, but the
declaration for the single-perameter version has remained since.
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
Commit 9d985082ad0bcb34dd1b9b146abe73907a7cf72b by kazu
[MachineLICM] Remove unused declaration HoistRegion

The function definition was removed on Dec 22, 2011 in commit
in 1eed5b51e87758affdbc10627b4a0884ab86606f.
The file was modifiedllvm/lib/CodeGen/MachineLICM.cpp
Commit 3ee08e38194ac05e42f8c5a633dc1aa8e41139f4 by yhegde
Add Semantic check for Flang OpenMP 4.5 - 2.15.3.2 and 2.15.3.3 shared and private clause

Semantic check to restrict the appearance of a variable that is part of another variable
(as an array or structure element) in a PRIVATE or SHARED clause.

Test Cases:

omp-parallel-private01.f90
omp-parallel-private02.f90
omp-parallel-private03.f90
omp-parallel-private04.f90
omp-parallel-shared01.f90
omp-parallel-shared02.f90
omp-parallel-shared03.f90
omp-parallel-shared04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

Differential Revision: https://reviews.llvm.org/D89395
The file was addedflang/test/Semantics/omp-parallel-private01.f90
The file was modifiedflang/lib/Semantics/check-omp-structure.cpp
The file was addedflang/test/Semantics/omp-parallel-shared01.f90
The file was addedflang/test/Semantics/omp-parallel-shared04.f90
The file was addedflang/test/Semantics/omp-parallel-shared03.f90
The file was addedflang/test/Semantics/omp-parallel-shared02.f90
The file was modifiedflang/lib/Semantics/check-omp-structure.h
The file was addedflang/test/Semantics/omp-parallel-private03.f90
The file was addedflang/test/Semantics/omp-parallel-private02.f90
The file was addedflang/test/Semantics/omp-parallel-private04.f90
Commit 68403af007fa1ecd67e0c96d94eb9253b76c759d by kazu
[MBP] Remove unused declaration shouldPredBlockBeOutlined (NFC)

The function was introduced on Jun 12, 2016 in commit
071d0f180794f7819c44026815614ce8fa00a3bd.  Its definition was removed
on Mar 2, 2017 in commit 1393761e0ca3fe8271245762f78daf4d5208cd77.
The file was modifiedllvm/lib/CodeGen/MachineBlockPlacement.cpp
Commit 1c0941e1524f499e3fbde48fc3bdd0e70fc8f2e4 by esme.yi
[PowerPC] Extend folding RLWINM + RLWINM to post-RA.

Summary: We have the patterns to fold 2 RLWINMs before RA, while some RLWINM will be generated after RA, for example rGc4690b007743. If the RLWINM generated after RA followed by another RLWINM, we expect to perform the optimization too.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D89855
The file was modifiedllvm/lib/Target/PowerPC/PPCInstrInfo.h
The file was modifiedllvm/lib/Target/PowerPC/PPCMIPeephole.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCInstrInfo.cpp
The file was addedllvm/test/CodeGen/PowerPC/fold-rlwinm-after-ra.mir
The file was modifiedllvm/test/CodeGen/PowerPC/vsx_builtins.ll