SuccessChanges

Summary

  1. [SystemZ] Fix vecintrin.h to not emit alignment hints in vec_xl/vec_xst. (details)
  2. [lldb] Fix up SysV ABI implementations after 057efa9916cdc354ef4653bcd128a578cc43125e (details)
  3. [NFC] Combine runNewPMPasses() and runNewPMCustomPasses() (details)
  4. [CSSPGO][llvm-profgen] Filter out the instructions without location info for symbolizer (details)
  5. Store the LocationKind of an entry value buffer independently from the main LocationKind (NFC) (details)
  6. [SYCL] Ignore file-scope asm during device-side SYCL compilation. (details)
  7. [OpenMP] fix test adding mapping of shared variables (details)
  8. [OpenMP] NFC: fix test removing the target construct (details)
  9. [llvm-objcopy] preserve file ownership when overwritten by root (details)
  10. [flang][fir] Add fir-opt tool (details)
  11. [flang][fir][NFC] Move FieldType to TableGen type definition (details)
  12. Revert "[flang][fir] Add fir-opt tool" (details)
  13. [FPEnv][ARM] Implement lowering of llvm.set.rounding (details)
  14. [test] Make ELF tests amenable to the order of non-local symbols (details)
  15. [LangRef] Update memory access ops to raise UB if ptrs are not well defined (details)
  16. [LTO] Perform DSOLocal propagation in combined index (details)
Commit b3ac5b84cdd46fc62a7215ae6b11f3c005900461 by paulsson
[SystemZ] Fix vecintrin.h to not emit alignment hints in vec_xl/vec_xst.

vec_xl() and vec_xst() should not emit alignment hints since they take a
scalar pointer and also add a byte offset if passed.

This patch uses memcpy to achieve the desired result.

Review: Ulrich Weigand

Differential Revision: https://reviews.llvm.org/D96471
The file was modifiedclang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c (diff)
The file was modifiedclang/lib/Headers/vecintrin.h (diff)
Commit 2dbe88db5804f32c6dfc1aa474881c3cb7a61d03 by benny.kra
[lldb] Fix up SysV ABI implementations after 057efa9916cdc354ef4653bcd128a578cc43125e
The file was modifiedlldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp (diff)
The file was modifiedlldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp (diff)
The file was modifiedlldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp (diff)
The file was modifiedlldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp (diff)
The file was modifiedlldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp (diff)
Commit 964f8103c58db5917c66ef39f50acf2004c90144 by aeubanks
[NFC] Combine runNewPMPasses() and runNewPMCustomPasses()

I've already witnessed two separate changes missing runNewPMPasses()
because runNewPMCustomPasses() is so similar.

This cleans up some duplicated code.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D96553
The file was modifiedllvm/lib/LTO/LTOBackend.cpp (diff)
Commit afd8bd601eaf268357e2cc0cf4c0382732fcf923 by wlei
[CSSPGO][llvm-profgen] Filter out the instructions without location info for symbolizer

It appears some instructions doesn't have the debug location info and the symbolizer will return an empty call stack for them which will cause some crash later in profile unwinding. Actually we do not record the sample info for them, so this change just filter out those instruction.

As those instruction would appears at the begin and end of the instruction list, without them we need to add the boundary check for IP `advance` and `backward`.

Also for pseudo probe based profile, we actually don't need the symbolized location info, so here just change to use an empty stack for it. This could save half of the binary loading time.

Differential Revision: https://reviews.llvm.org/D96434
The file was modifiedllvm/test/tools/llvm-profgen/recursion-compression-noprobe.test (diff)
The file was modifiedllvm/tools/llvm-profgen/ProfiledBinary.h (diff)
The file was modifiedllvm/tools/llvm-profgen/ProfileGenerator.cpp (diff)
The file was modifiedllvm/test/tools/llvm-profgen/noinline-cs-noprobe.test (diff)
The file was modifiedllvm/test/tools/llvm-profgen/inline-cs-noprobe.test (diff)
The file was modifiedllvm/tools/llvm-profgen/ProfiledBinary.cpp (diff)
The file was modifiedllvm/tools/llvm-profgen/PerfReader.cpp (diff)
Commit 982b891905349e9d6b82f8d89d325b6f2e838435 by Adrian Prantl
Store the LocationKind of an entry value buffer independently from the main LocationKind (NFC)

This patch hides the logic for setting the location kind of an entry
value inside the begin/finalize/cancel functions. This way we get rid
the strange workaround that is currently in setLocation().

In the future, this will allow us to set the location kind of the
entry value independently from the location kind of the main
expression.

Differential Revision: https://reviews.llvm.org/D96554
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfExpression.h (diff)
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp (diff)
Commit ff50b121e336503621da80676116f82d82e91196 by artur.gainullin
[SYCL] Ignore file-scope asm during device-side SYCL compilation.

Reviewed By: bader, eandrews

Differential Revision: https://reviews.llvm.org/D96538
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp (diff)
The file was addedclang/test/CodeGenSYCL/filescope_asm.c
Commit 091e8daa24de6c348674f7507c0cf9b0f9395607 by Andrey.Churbanov
[OpenMP] fix test adding mapping of shared variables
The file was modifiedopenmp/runtime/test/teams/kmp_num_teams.c (diff)
Commit 5631842d181016207e85e4d035d0c4383f34337a by Andrey.Churbanov
[OpenMP] NFC: fix test removing the target construct
The file was modifiedopenmp/runtime/test/teams/kmp_num_teams.c (diff)
Commit c2a84771bb63947695ea50b89160c02b36fb634d by jiancai
[llvm-objcopy] preserve file ownership when overwritten by root

As of binutils 2.36, GNU strip calls chown(2) for "sudo strip foo" and
"sudo strip foo -o foo", but no "sudo strip foo -o bar" or "sudo strip
foo -o ./foo". In other words, while "sudo strip foo -o bar" creates a
new file bar with root access, "sudo strip foo" will keep the owner and
group of foo unchanged. Currently llvm-objcopy and llvm-strip behave
differently, always changing the owner and gropu to root. The
discrepancy prevents Chrome OS from migrating to llvm-objcopy and
llvm-strip as they change file ownership and cause intended users/groups
to lose access when invoked by sudo with the following sequence
(recommended in man page of GNU strip).

1.<Link the executable as normal.>
1.<Copy "foo" to "foo.full">
1.<Run "strip --strip-debug foo">
1.<Run "objcopy --add-gnu-debuglink=foo.full foo">

This patch makes llvm-objcopy and llvm-strip follow GNU's behavior.

Link: crbug.com/1108880
The file was modifiedllvm/tools/llvm-objcopy/Buffer.h (diff)
The file was modifiedllvm/include/llvm/Support/FileSystem.h (diff)
The file was modifiedllvm/tools/llvm-objcopy/Buffer.cpp (diff)
The file was modifiedllvm/include/llvm/Support/FileOutputBuffer.h (diff)
The file was modifiedllvm/lib/Support/Unix/Path.inc (diff)
The file was modifiedllvm/tools/llvm-objcopy/llvm-objcopy.cpp (diff)
The file was modifiedllvm/lib/Support/FileOutputBuffer.cpp (diff)
Commit df1eeaa7b404f7c5a96a812479f0ee2ce8354f6a by clementval
[flang][fir] Add fir-opt tool

This patch introduce the fir-opt tool. Similar to mlir-opt for FIR.
It will be used in following patches to test fir opt and round-trip.

Reviewed By: schweitz, mehdi_amini

Differential Revision: https://reviews.llvm.org/D96535
The file was addedflang/tools/fir-opt/CMakeLists.txt
The file was modifiedflang/tools/CMakeLists.txt (diff)
The file was modifiedflang/test/Fir/fir-ops.fir (diff)
The file was modifiedflang/test/Fir/fir-types.fir (diff)
The file was addedflang/tools/fir-opt/fir-opt.cpp
The file was modifiedflang/test/CMakeLists.txt (diff)
Commit 8c1b63307f0696058bf4a9f7a54b012867f2457e by clementval
[flang][fir][NFC] Move FieldType to TableGen type definition

This patch is a follow up of D96422 and move ComplexType to TableGen.

Reviewed By: schweitz, mehdi_amini

Differential Revision: https://reviews.llvm.org/D96610
The file was modifiedflang/lib/Optimizer/Dialect/FIRType.cpp (diff)
The file was modifiedflang/include/flang/Optimizer/Dialect/FIRTypes.td (diff)
The file was modifiedflang/include/flang/Optimizer/Dialect/FIRType.h (diff)
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROps.td (diff)
Commit af186e93723837a507042acf1d7338e125706129 by clementval
Revert "[flang][fir] Add fir-opt tool"

This reverts commit df1eeaa7b404f7c5a96a812479f0ee2ce8354f6a.

Buildbot failure.
The file was modifiedflang/test/Fir/fir-ops.fir (diff)
The file was modifiedflang/test/CMakeLists.txt (diff)
The file was modifiedflang/tools/CMakeLists.txt (diff)
The file was removedflang/tools/fir-opt/fir-opt.cpp
The file was modifiedflang/test/Fir/fir-types.fir (diff)
The file was removedflang/tools/fir-opt/CMakeLists.txt
Commit 816053bc71751cac46aef085f57b7f305c7bbcd1 by sepavloff
[FPEnv][ARM] Implement lowering of llvm.set.rounding

Differential Revision: https://reviews.llvm.org/D96501
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.h (diff)
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp (diff)
The file was addedllvm/test/CodeGen/ARM/fpenv.ll
Commit 1f69355802ad446d95b4f71c421dd4100eb8aa77 by i
[test] Make ELF tests amenable to the order of non-local symbols
The file was modifiedlld/test/ELF/conflict-debug-variable2.s (diff)
The file was modifiedlld/test/ELF/combreloc.s (diff)
The file was modifiedlld/test/ELF/gc-sections-shared.s (diff)
The file was modifiedlld/test/ELF/global-offset-table-position-i386.s (diff)
The file was modifiedlld/test/ELF/conflict-debug-variable.s (diff)
The file was modifiedlld/test/ELF/comdat-discarded-lazy.s (diff)
The file was modifiedlld/test/ELF/common-gc.s (diff)
The file was modifiedllvm/test/MC/ELF/undef.s (diff)
The file was modifiedlld/test/ELF/aarch64-tls-ie.s (diff)
The file was modifiedlld/test/ELF/ppc64-error-missaligned-ds.s (diff)
The file was modifiedlld/test/ELF/symbol-ordering-file-warnings.s (diff)
The file was modifiedllvm/test/MC/ELF/symver.s (diff)
The file was modifiedllvm/test/MC/ELF/weakref.s (diff)
The file was modifiedlld/test/ELF/undef-version-script.s (diff)
The file was modifiedlld/test/ELF/gnu-hash-table-rwsegment.s (diff)
The file was modifiedlld/test/ELF/arm-gnu-ifunc.s (diff)
The file was modifiedlld/test/ELF/ehdr_start.s (diff)
The file was modifiedlld/test/ELF/edata-etext.s (diff)
The file was modifiedlld/test/ELF/ppc64-error-missaligned-dq.s (diff)
The file was modifiedlld/test/ELF/resolution.s (diff)
The file was modifiedlld/test/ELF/linkerscript/ehdr_start.s (diff)
The file was modifiedlld/test/ELF/global-offset-table-position-aarch64.s (diff)
The file was modifiedlld/test/ELF/dynamic-list-glob.s (diff)
The file was modifiedlld/test/ELF/gnu-hash-table.s (diff)
The file was modifiedllvm/test/MC/ELF/type.s (diff)
The file was modifiedlld/test/ELF/linkerscript/common-assign.s (diff)
The file was modifiedlld/test/ELF/common-gc2.s (diff)
The file was modifiedlld/test/ELF/linkerscript/common-exclude.s (diff)
The file was modifiedlld/test/ELF/defsym.s (diff)
Commit 1f6ec3d08f75dba6c93c291bd92552b807736eb3 by aqjune
[LangRef] Update memory access ops to raise UB if ptrs are not well defined

In the past, it was stated in D87994 that it is allowed to dereference a pointer that is partially undefined
if all of its possible representations fit into a dereferenceable range.
The motivation of the direction was to make a range analysis helpful for assuring dereferenceability.
Even if a range analysis concludes that its offset is within bounds, the offset could still be partially undefined; to utilize the range analysis, this relaxation was necessary.
https://groups.google.com/g/llvm-dev/c/2Qk4fOHUoAE/m/KcvYMEgOAgAJ has more context about this.

However, this is currently blocking another optimization, which is annotating the noundef attribute for library functions' arguments. D95122 is the patch.
Currently, there are quite a few library functions which cannot have noundef attached to its pointer argument because it can be transformed from load/store.
For example, MemCpyOpt can convert stores into memset:

```
store p, i32 0
store (p+1), i32 0 // Since currently it is allowed for store to have partially undefined pointer..
->
memset(p, 0, 8)    // memset cannot guarantee that its ptr argument is noundef.
```

A bigger problem is that this makes unclear which library functions are allowed to have 'noundef' and which functions aren't (e.g., strlen).
This makes annotating noundef almost impossible for this kind of functions.

This patch proposes that all memory operations should have well-defined pointers.
For memset/memcpy, it is semantically equivalent to running a loop until the size is met (and branching on undef is UB), so the size is also updated to be well-defined.

Strictly speaking, this again violates the implication of dereferenceability from range analysis result.
However, I think this is okay for the following reasons:

1. It seems the existing analyses in the LLVM main repo does not have conflicting implementation with the new proposal.
`isDereferenceableAndAlignedPointer` works only when the GEP offset is constant, and `isDereferenceableAndAlignedInLoop` is also fine.

2. A possible miscompilation happens only when the source has a pointer with a *partially* undefined offset (it's okay with poison because there is no 'partially poison' value).
But, at least I'm not aware of a language using LLVM as backend that has a well-defined program while allowing partially undefined pointers.
There might be such a language that I'm not aware of, but improving the performance of the mainstream languages like C and Rust is more important IMHO.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D95238
The file was modifiedllvm/docs/LangRef.rst (diff)
Commit 80dc0661bd8bba92fb0843cac3bdc061c093039f by apollo.mobility
[LTO] Perform DSOLocal propagation in combined index

Perform DSOLocal propagation within summary list of every GV. This
avoids the repeated query of this information during function
importing.

Differential Revision: https://reviews.llvm.org/D96398
The file was modifiedllvm/lib/IR/ModuleSummaryIndex.cpp (diff)
The file was modifiedllvm/include/llvm/IR/ModuleSummaryIndex.h (diff)
The file was modifiedllvm/test/Bitcode/thinlto-synthetic-count-flag.ll (diff)
The file was modifiedllvm/lib/LTO/LTO.cpp (diff)
The file was modifiedllvm/lib/Transforms/Utils/FunctionImportUtils.cpp (diff)
The file was modifiedllvm/lib/Bitcode/Reader/BitcodeReader.cpp (diff)
The file was modifiedllvm/test/Assembler/summary-flags.ll (diff)
The file was modifiedllvm/test/Bitcode/thinlto-deadstrip-flag.ll (diff)