[PATCH] D127607: Add pass to turn function into Unreachable and script to find UB. (WIP)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 12 14:28:04 PDT 2022


fhahn created this revision.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This adds a pass to replace function bodies with 'unreachable' and a
script that checks if the result still verifies.

This can be used to find functions in llvm-lit tests that have
unconditional UB using

  llvm-lit -j4 -sv -Dopt=~/find-ub-in-test.sh

Examples of found & fixed UB:

- b8d728a098b1 <https://reviews.llvm.org/rGb8d728a098b10f0f9afdc3fe8641b4678f57f1e6>
- 684a82fbc543 <https://reviews.llvm.org/rG684a82fbc5434c9673c396b53e09baf902259a54>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127607

Files:
  llvm/include/llvm/Transforms/Scalar/ToUnreachable.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/ToUnreachable.cpp
  llvm/utils/find-ub-in-test.sh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127607.436252.patch
Type: text/x-patch
Size: 5250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220612/bff929a2/attachment.bin>


More information about the llvm-commits mailing list