SuccessChanges

Summary

  1. [InstCombine] reduce code duplication; NFC (details)
  2. [InstCombine] fold zext of masked bit set/clear (details)
  3. [RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases (details)
  4. [Support] Fix getMainExecutable on FreeBSD when called via an absolute path (details)
  5. Revert "[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases" (details)
  6. [clang-format] successive C# attributes cause line breaking issues (details)
Commit 52f2970036019b54f280bd531c7c65c09e18567a by spatel
[InstCombine] reduce code duplication; NFC
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
Commit c7da0c383a1bb360887a51f094d5891a9108d767 by spatel
[InstCombine] fold zext of masked bit set/clear

This does not solve PR17101, but it is one of the
underlying diffs noted here:
https://bugs.llvm.org/show_bug.cgi?id=17101#c8

We could ease the one-use checks for the 'clear'
(no 'not' op) half of the transform, but I do not
know if that asymmetry would make things better
or worse.

Proofs:
https://rise4fun.com/Alive/uVB

Name: masked bit set
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp ne i32 %and, 0
%r = zext i1 %cmp to i32
=>
%s = lshr i32 %x, %y
%r = and i32 %s, 1

Name: masked bit clear
%sh1 = shl i32 1, %y
%and = and i32 %sh1, %x
%cmp = icmp eq i32 %and, 0
%r = zext i1 %cmp to i32
=>
%xn = xor i32 %x, -1
%s = lshr i32 %xn, %y
%r = and i32 %s, 1

Note: this is a re-post of a patch that I committed at:
rGa041c4ec6f7a

The commit was reverted because it exposed another bug:
rGb212eb7159b40

But that has since been corrected with:
rG8a156d1c2795189 ( D101191 )

Differential Revision: https://reviews.llvm.org/D72396
The file was modifiedllvm/test/Transforms/InstCombine/zext.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
Commit aa9a30b83a06e3e5e68e32ea645ec2d9edc27efc by jrtc27
[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases

Whilst here, also remove a couple of unnecessary -o - instances.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D103201
The file was modifiedllvm/test/MC/RISCV/rv32zbbp-only-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv64b.s
The file was modifiedllvm/test/MC/RISCV/option-pic.s
The file was modifiedllvm/test/MC/RISCV/rvv/load.s
The file was modifiedllvm/test/MC/RISCV/rv64i-aliases-invalid.s
The file was modifiedllvm/test/MC/RISCV/rvc-hints-valid.s
The file was modifiedllvm/test/CodeGen/RISCV/patchable-function-entry.ll
The file was modifiedllvm/test/MC/RISCV/rv64-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvzfh-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/supervisor-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvv/fothers.s
The file was modifiedllvm/test/MC/RISCV/rvv/store.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32i.s
The file was modifiedllvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
The file was modifiedllvm/test/MC/RISCV/compress-rv32b.s
The file was modifiedllvm/test/MC/RISCV/rv32fc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64zfh-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvv/aliases.s
The file was modifiedllvm/test/MC/RISCV/rvv/zvlsseg.s
The file was modifiedllvm/test/MC/RISCV/rv32b-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32zfh-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64a-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64i-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64c-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32dc-valid.s
The file was modifiedllvm/test/MC/RISCV/machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/option-rvc.s
The file was modifiedllvm/test/MC/RISCV/rvc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64a-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64d-valid.s
The file was modifiedllvm/test/MC/RISCV/deprecated-csr-names.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32d.s
The file was modifiedllvm/test/MC/RISCV/rv64d-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32i-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/fixups.s
The file was modifiedllvm/test/MC/RISCV/relocations.s
The file was modifiedllvm/test/MC/RISCV/rv32e-valid.s
The file was modifiedllvm/test/MC/RISCV/option-pushpop.s
The file was modifiedllvm/test/MC/RISCV/rv64c-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32i-aliases-invalid.s
The file was modifiedllvm/test/MC/RISCV/rv32i-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-debug-info.s
The file was modifiedllvm/test/MC/RISCV/rv64i-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64zbb-valid.s
The file was modifiedllvm/test/MC/RISCV/priv-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64zbproposedc-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32c-only-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv/others.s
The file was modifiedllvm/test/MC/RISCV/rva-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/debug-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32d-valid.s
The file was modifiedllvm/test/MC/RISCV/rvf-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv64i.s
The file was modifiedllvm/test/MC/RISCV/rv32-machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/option-nopic.s
The file was modifiedllvm/test/MC/RISCV/rv32zbproposedc-valid.s
The file was modifiedllvm/test/MC/RISCV/rvf-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvd-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-cjal.s
The file was modifiedllvm/test/MC/RISCV/rv64c-hints-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32zbb-valid.s
The file was modifiedllvm/test/MC/RISCV/user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32f-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32c-valid.s
The file was modifiedllvm/test/MC/RISCV/compressed-relocations.s
The file was modifiedllvm/test/MC/RISCV/rv32c-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32m-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32f.s
The file was modifiedllvm/test/MC/RISCV/rv32fc-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32a-valid.s
The file was modifiedllvm/test/MC/RISCV/rvdc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64-machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv64f-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64b-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64f-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64m-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64dc-valid.s
Commit 762f707c0072abba60b5b4bdbb64c2c69c6152b1 by jrtc27
[Support] Fix getMainExecutable on FreeBSD when called via an absolute path

On FreeBSD, absolute paths are passed unmodified in AT_EXECPATH, but
relative paths are resolved to absolute paths, and any symlinks will be
followed in the process. This means that the resource dir calculation
will be wrong if Clang is invoked as an absolute path to a symlink, and
this currently causes clang/test/Driver/rocm-detect.hip to fail on
FreeBSD. Thus, make sure to call realpath on the result, just like is
done on macOS.

Whilst here, clean up the old fallback auxargs loop to use the actual
type for auxargs rather than using lots of hacky casts that rely on
addresses and pointers being the same (which is not the case on CHERI,
and thus Arm's prototype Morello, although for little-endian systems it
happens to work still as the word-sized integer will be padded to a full
pointer, and it's someone academic given dereferencing past the end of
environ will give a bounds fault, but CheriBSD is new enough that the
elf_aux_info path will be used). This also makes the code easier to
follow, and removes the confusing double-increment of p.

Reviewed By: dim, arichardson

Differential Revision: https://reviews.llvm.org/D103346
The file was modifiedllvm/lib/Support/Unix/Path.inc
Commit 00dfd4f870411b1b4353906163dd8b673076850b by jrtc27
Revert "[RISCV] Remove -riscv-no-aliases in favour of new -M no-aliases"

The replacement doesn't work for llc, but it is needed by
patchable-function-entry.ll.

This reverts commit aa9a30b83a06e3e5e68e32ea645ec2d9edc27efc.
The file was modifiedllvm/test/MC/RISCV/fixups.s
The file was modifiedllvm/test/MC/RISCV/rvdc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32a-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32c-only-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64d-valid.s
The file was modifiedllvm/test/MC/RISCV/option-nopic.s
The file was modifiedllvm/test/MC/RISCV/rv32zbproposedc-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv/aliases.s
The file was modifiedllvm/test/MC/RISCV/rvf-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32f-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32d-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64i-aliases-invalid.s
The file was modifiedllvm/test/MC/RISCV/rv32fc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32i-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvf-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/compressed-relocations.s
The file was modifiedllvm/test/MC/RISCV/rv32i-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv/others.s
The file was modifiedllvm/test/MC/RISCV/rvv/load.s
The file was modifiedllvm/test/MC/RISCV/compress-rv64b.s
The file was modifiedllvm/test/MC/RISCV/rv64zbproposedc-valid.s
The file was modifiedllvm/test/MC/RISCV/rvv/zvlsseg.s
The file was modifiedllvm/test/MC/RISCV/option-pushpop.s
The file was modifiedllvm/test/MC/RISCV/rv32e-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64a-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-cjal.s
The file was modifiedllvm/test/MC/RISCV/compress-rv64i.s
The file was modifiedllvm/test/MC/RISCV/rvd-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rvzfh-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32-machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32i-aliases-invalid.s
The file was modifiedllvm/test/MC/RISCV/rv64-machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv64f-aliases-valid.s
The file was modifiedllvm/test/CodeGen/RISCV/patchable-function-entry.ll
The file was modifiedllvm/test/MC/RISCV/rv32dc-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32b-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/option-rvc.s
The file was modifiedllvm/test/MC/RISCV/rv64i-valid.s
The file was modifiedllvm/test/MC/RISCV/rva-aliases-valid.s
The file was modifiedllvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
The file was modifiedllvm/test/MC/RISCV/rv64m-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64zfh-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32c-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64c-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/option-pic.s
The file was modifiedllvm/test/MC/RISCV/machine-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32m-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32f.s
The file was modifiedllvm/test/MC/RISCV/rvc-hints-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32d.s
The file was modifiedllvm/test/MC/RISCV/rv64zbb-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64c-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64b-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32fc-valid.s
The file was modifiedllvm/test/MC/RISCV/user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv64f-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64c-hints-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32i.s
The file was modifiedllvm/test/MC/RISCV/supervisor-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rvv/fothers.s
The file was modifiedllvm/test/MC/RISCV/rv64dc-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64d-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32-user-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv32zbbp-only-valid.s
The file was modifiedllvm/test/MC/RISCV/rv64i-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/debug-valid.s
The file was modifiedllvm/test/MC/RISCV/compress-rv32b.s
The file was modifiedllvm/test/MC/RISCV/rvv/store.s
The file was modifiedllvm/test/MC/RISCV/priv-valid.s
The file was modifiedllvm/test/MC/RISCV/rvc-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/deprecated-csr-names.s
The file was modifiedllvm/test/MC/RISCV/rv64a-aliases-valid.s
The file was modifiedllvm/test/MC/RISCV/relocations.s
The file was modifiedllvm/test/MC/RISCV/compress-debug-info.s
The file was modifiedllvm/test/MC/RISCV/rv32zbb-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32zfh-valid.s
The file was modifiedllvm/test/MC/RISCV/rv32c-valid.s
Commit ffb48d48e45c72ed81dda4983ccb06e800cdbbd0 by mydeveloperday
[clang-format] successive C# attributes cause line breaking issues

{D74265} reduced the aggressiveness of line breaking following C# attributes, however this change removed any support for attributes on properties, causing significant ugliness to be introduced.

This revision goes some way to addressing that by re-introducing the more aggressive check to `mustBreakBefore()`, but constraining it to the most common cases where we use properties which should not impact the "caller info attributes"  or the "[In , Out]" decorations that are normally put on pinvoke

It does not address my additional concerns of the original change regarding multiple C# attributes, as these are somewhat incorrectly handled by virtue of the fact its not recognising the second attribute as an attribute at all. But instead thinking its an array.

The purpose of this revision is to get back to where we were for the most common of cases as a stepping stone to resolving this. However {D74265} has broken a lot of C# code and this revision will go someway alone to addressing the majority.

Reviewed By: jbcoe, HazardyKnusperkeks, curdeius

Differential Revision: https://reviews.llvm.org/D103307
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/unittests/Format/FormatTestCSharp.cpp