SuccessChanges

Summary

  1. Recommit "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator." (details)
  2. Revert "GlobalISel: Use & operator on KnownBits" (details)
  3. Correctly revert "GlobalISel: Use & operator on KnownBits" (details)
  4. AMDGPU: Fix broken switch braces (details)
  5. AMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize (details)
  6. GlobalISel: Implement computeNumSignBits for G_SEXT_INREG (details)
Commit c10e63677f5d20f18010f8f68c631ddc97546f7d by dokyungs
Recommit "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."

The CrossOver mutator is meant to cross over two given buffers (referred to as
the first/second buffer henceforth). Previously InsertPartOf/CopyPartOf calls
used in the CrossOver mutator incorrectly inserted/copied part of the second
buffer into a "scratch buffer" (MutateInPlaceHere of the size
CurrentMaxMutationLen), rather than the first buffer. This is not intended
behavior, because the scratch buffer does not always (i) contain the content of
the first buffer, and (ii) have the same size as the first buffer;
CurrentMaxMutationLen is typically a lot larger than the size of the first
buffer. This patch fixes the issue by using the first buffer instead of the
scratch buffer in InsertPartOf/CopyPartOf calls.

A FuzzBench experiment was run to make sure that this change does not
inadvertently degrade the performance. The performance is largely the same; more
details can be found at:
https://storage.googleapis.com/fuzzer-test-suite-public/fixcrossover-report/index.html

This patch also adds two new tests, namely "cross_over_insert" and
"cross_over_copy", which specifically target InsertPartOf and CopyPartOf,
respectively.

- cross_over_insert.test checks if the fuzzer can use InsertPartOf to trigger
  the crash.

- cross_over_copy.test checks if the fuzzer can use CopyPartOf to trigger the
  crash.

These newly added tests were designed to pass with the current patch, but not
without the it (with 790878f291fa5dc58a1c560cb6cc76fd1bfd1c5a these tests do not
pass). To achieve this, -max_len was intentionally given a high value. Without
this patch, InsertPartOf/CopyPartOf will generate larger inputs, possibly with
unpredictable data in it, thereby failing to trigger the crash.

The test pass condition for these new tests is narrowed down by (i) limiting
mutation depth to 1 (i.e., a single CrossOver mutation should be able to trigger
the crash) and (ii) checking whether the mutation sequence of "CrossOver-" leads
to the crash.

Also note that these newly added tests and an existing test (cross_over.test)
all use "-reduce_inputs=0" flags to prevent reducing inputs; it's easier to
force the fuzzer to keep original input string this way than tweaking
cov-instrumented basic blocks in the source code of the fuzzer executable.

Differential Revision: https://reviews.llvm.org/D85554
The file was addedcompiler-rt/test/fuzzer/cross_over_insert.test
The file was modifiedcompiler-rt/lib/fuzzer/FuzzerMutate.cpp
The file was modifiedcompiler-rt/test/fuzzer/cross_over.test
The file was modifiedcompiler-rt/test/fuzzer/CrossOverTest.cpp
The file was addedcompiler-rt/test/fuzzer/cross_over_copy.test
Commit 6cf4f256701de964dc540f18dfadce5bd49476eb by Matthew.Arsenault
Revert "GlobalISel: Use & operator on KnownBits"

This reverts commit e53b799779b079a70f600e5cad2ab7267d66b1b7.

Confusingly, this does not simply and the two sets of known bits, but
implements known bits for the and operator.
The file was modifiedllvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Commit f08bbde83f472c6f8a01d7a92cf712da30753b7b by Matthew.Arsenault
Correctly revert "GlobalISel: Use & operator on KnownBits"

I mis-resolved the revert through moving the code to another function.
The file was modifiedllvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-and.mir
Commit 9d3dc276a698248b065d16c5b6b39939b9bb5281 by Matthew.Arsenault
AMDGPU: Fix broken switch braces
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
Commit af1c1e20f47de56964bafb92638b607779fa6b54 by Matthew.Arsenault
AMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-and.mir
Commit 5feca7c9c336ed70c57e44a43f2677498480a56f by Matthew.Arsenault
GlobalISel: Implement computeNumSignBits for G_SEXT_INREG
The file was modifiedllvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
The file was modifiedllvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp