Changes

Summary

  1. Revert "Revert "DirectoryWatcher: add an implementation for Windows"" (details)
  2. [X86] Add ISD::FREEZE and ISD::AssertAlign to the list of opcodes that don't guarantee upper 32 bits are zero. (details)
  3. [CHR] Don't run ControlHeightReduction if any BB has address taken (details)
  4. [llvm-objcopy] Exclude empty sections in IHexWriter output (details)
  5. Use dyn_cast_or_null instead of dyn_cast in FunctionLike::verifyTrait (NFC) (details)
  6. [NFC][X86][Codegen] Add shuffle test that would benefit from sorting in reduceBuildVecToShuffle() (details)
  7. Simplify getArgAttrDict/getResultAttrDict by removing unnecessary checks (details)
Commit 76f1baa7875acd88bdd4b431eed6e2d2decfc0fe by Saleem Abdulrasool
Revert "Revert "DirectoryWatcher: add an implementation for Windows""

This reverts commit 0ec1cf13f2a4e31aa2c5ccc665c5fbdcd3a94577.

Restore the implementation with some minor tweaks:
- Use std::unique_ptr for the path instead of std::vector
  * Stylistic improvement as the buffer is already heap allocated, this
    just makes it clearer.
- Correct the notification buffer allocation size
  * Memory usage fix: we were allocating 4x the computed size
- Correct the passing of the buffer size to RDC
  * Memory usage fix: we were reporting 1/4th of the size
- Convert the operation event to auto-reset
  * Bug Fix: we never reset the event
- Remove `FILE_NOTIFY_CHANGE_LAST_ACCESS` from RDC events
  * Memory usage fix: we never needed this notification
- Fold events for the notification action
  * Stylistic improvement to be clear how the events map
- Update comment
  * Stylistic improvement to be clear what the RAII controls
- Fix the race condition that was uncovered previously
  * We would return from the construction before the watcher thread
    began execution.  The test would then proceed to begin execution,
    and we would miss the initial notifications.  We now ensure that the
    watcher thread is initialized before we return.  This ensures that
    we do not miss the initial notifications.

Running the test on a SSD was able to uncover the access pattern.  This
now seems to pass reliably where it was previously flaky locally.
The file was modifiedclang/unittests/DirectoryWatcher/CMakeLists.txt (diff)
The file was modifiedclang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp (diff)
Commit c997867dc084a1bcf631816f964b3ff49a297ba3 by craig.topper
[X86] Add ISD::FREEZE and ISD::AssertAlign to the list of opcodes that don't guarantee upper 32 bits are zero.

The freeze issue was reported here
https://llvm.discourse.group/t/bug-or-feature-freeze-instruction/3639

I don't have a test for AssertAlign. I just noticed it was missing
and assume it should be similar to the other two Asserts.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D104178
The file was modifiedllvm/test/CodeGen/X86/freeze.ll (diff)
The file was modifiedllvm/lib/Target/X86/X86InstrCompiler.td (diff)
Commit fae7debadcea335d4aaddee82406a8d10426e730 by lxfind
[CHR] Don't run ControlHeightReduction if any BB has address taken

This patch is to address https://bugs.llvm.org/show_bug.cgi?id=50610.
In computed goto pattern, there are usually a list of basic blocks that are all targets of indirectbr instruction, and each basic block also has address taken and stored in a variable.
CHR pass could potentially clone these basic blocks, which would generate a cloned version of the indirectbr and clonved version of all basic blocks in the list.
However these basic blocks will not have their addresses taken and stored anywhere. So latter SimplifyCFG pass will simply remove all tehse cloned basic blocks, resulting in incorrect code.
To fix this, when searching for scopes, we skip scopes that contains BBs with addresses taken.
Added a few test cases.

Reviewed By: aeubanks, wenlei, hoy

Differential Revision: https://reviews.llvm.org/D103867
The file was modifiedllvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp (diff)
The file was modifiedllvm/test/Transforms/PGOProfile/chr.ll (diff)
Commit 5899278758b66a5e72c1ae9695651c2aef7406c4 by i
[llvm-objcopy] Exclude empty sections in IHexWriter output

IHexWriter was evaluating a section's physical address when deciding if
that section should be written to an output. This approach does not
account for a zero-sized section that has the same physical address as a
sized section. The behavior varies from GNU objcopy, and may result in a
HEX file that does not include all program sections.

The IHexWriter now excludes zero-sized sections when deciding what
should be written to the output. This affects the contents of the
writer's `Sections` collection; we will not try to insert multiple
sections that could have the same physical address. The behavior seems
consistent with GNU objcopy, which always excludes empty sections,
no matter the address.

The new test case evaluates the IHexWriter behavior when provided a
variety of empty sections that overlap or append a filled section. See
the input file's comments for more information. Given that test input,
and the change to the IHexWriter, GNU objcopy and llvm-objcopy produce
the same output.

Reviewed By: jhenderson, MaskRay, evgeny777

Differential Revision: https://reviews.llvm.org/D101332
The file was addedllvm/test/tools/llvm-objcopy/ELF/ihex-writer-empty-sections.test
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.cpp (diff)
The file was modifiedllvm/test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-sections2.yaml (diff)
Commit 8bc1ce0f61da0b2d0c3a17aec898df7001336ea5 by joker.eph
Use dyn_cast_or_null instead of dyn_cast in FunctionLike::verifyTrait (NFC)

This is making the verifier more tolerant to cases where a "null"
Attribute would be inserted in the array of func arguments/results
attributes.
The file was modifiedmlir/include/mlir/IR/FunctionSupport.h (diff)
Commit 2db64e199aa3b48d3495da3620c8cdb045da94f3 by lebedev.ri
[NFC][X86][Codegen] Add shuffle test that would benefit from sorting in reduceBuildVecToShuffle()
The file was modifiedllvm/test/CodeGen/X86/oddshuffles.ll (diff)
Commit 152c9871e6ac7ba2a14dcc64e812b79193421846 by joker.eph
Simplify getArgAttrDict/getResultAttrDict by removing unnecessary checks

There is a slight change in behavior: if the arg dictionnary is empty
then we return this empty dictionnary instead of a null attribute.
This is more consistent with accessing it through:

  ArrayAttr args_attr = func_op.getAllArgAttrs();
  args_attr[num].cast<DictionnaryAttr>() ...

Differential Revision: https://reviews.llvm.org/D104189
The file was modifiedmlir/lib/IR/FunctionSupport.cpp (diff)