Changes

Summary

  1. [InstCombine] add tests for casted insertelement; NFC (details)
  2. [OpenMP] Add GOMP allocator functions (details)
  3. [WebAssembly] Add prototype relaxed float min max instructions (details)
  4. Fix unused variable warning. (details)
  5. [mlir] fix region property generation in python bindings (details)
  6. InvalidPtrChecker - don't dereference a dyn_cast<> - use cast<> instead. (details)
  7. [IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol (details)
  8. [Clang][AST] Resolve FIXME: Remove ObjCObjectPointer from (details)
  9. [NFC] De-template LazyCallGraph::visitReferences() and move into .cpp file (details)
  10. Raise compile error when using unimplemented functions (details)
  11. Precommit InstCombine/and-xor-or.ll test. NFC. (details)
  12. [clang] Disallow mixing SEH and Objective-C exceptions (details)
  13. [ORC-RT] Configure the ORC runtime for more architectures and platforms (details)
  14. [InstCombine] fold fake vector insert to bit-logic (details)
  15. [lld/mac] Remove else-after-return in ICF code (details)
  16. [MC] Recursively calculate symbol offset (details)
  17. [AMDGPU] Allow rematerialization of SOP with virtual registers (details)
  18. [AMDGPU] MachineLICM cannot hoist VALU (details)
  19. [lldb] Remove variable "any" which is set but not used (details)
  20. [AArch64][GlobalISel] combine (and (or x, c1), c2) => (and x, c2) iff c1 & c2 == 0 (details)
  21. Drop transfer_read inner most unit dimensions (details)
  22. Update ext-int test to have x86 linux/windows before ABI Impl (details)
  23. [fir] Add Character helper (details)
  24. Make dr177x.cpp test work with Windows-32 bit platfroms with 'thiscall'. (details)
  25. [mlir][sparse] make index type explicit in public API of support library (details)
  26. [IndVars] Invalidate SCEV when IR is changed in rewriteLoopExitValue. (details)
Commit ea9a0556b451a6c439299842ba71972e25dac6e6 by spatel
[InstCombine] add tests for casted insertelement; NFC
The file was addedllvm/test/Transforms/InstCombine/bitcast-inselt-bitcast.ll
Commit 99d1ce4a621aff2871f64c856545545f112051dc by nawrin.sultana
[OpenMP] Add GOMP allocator functions

This patch adds GOMP_alloc and GOMP_free functions of LIBGOMP.

Differential revision: https://reviews.llvm.org/D111673
The file was modifiedopenmp/runtime/src/exports_so.txt
The file was modifiedopenmp/runtime/src/kmp_ftn_os.h
The file was modifiedopenmp/runtime/src/kmp_gsupport.cpp
Commit e1fb13401e1b90a912ba83c6d1a82794cfdb8aec by tlively
[WebAssembly] Add prototype relaxed float min max instructions

Add relaxed. f32x4.min, f32x4.max, f64x2.min, f64x2.max. These are only
exposed as builtins, and require user opt-in.

Differential Revision: https://reviews.llvm.org/D112146
The file was modifiedclang/include/clang/Basic/BuiltinsWebAssembly.def
The file was modifiedllvm/include/llvm/IR/IntrinsicsWebAssembly.td
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
The file was modifiedclang/test/CodeGen/builtins-wasm.c
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
The file was modifiedllvm/test/MC/WebAssembly/simd-encodings.s
Commit 6b6564fcf9f5cce91630d1888d7e95b187bfc320 by saugustine
Fix unused variable warning.
The file was modifiedcompiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp
Commit 310736e098f874bb324d1b96d62682e9fb005015 by zinenko
[mlir] fix region property generation in python bindings
The file was modifiedmlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
The file was modifiedmlir/test/mlir-tblgen/op-python-bindings.td
Commit 7562f3df89066ab92a816dc23005c45fd642bdf9 by llvm-dev
InvalidPtrChecker - don't dereference a dyn_cast<> - use cast<> instead.

Avoid dereferencing a nullptr returned by dyn_cast<>, by using cast<> instead which asserts that the cast is valid.
The file was modifiedclang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp
Commit 08ed216000b6503a4a4be52f18394d008d5fb8f4 by i
[IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol

As discussed in:
* https://reviews.llvm.org/D94166
* https://lists.llvm.org/pipermail/llvm-dev/2020-September/145031.html

The GlobalIndirectSymbol class lost most of its meaning in
https://reviews.llvm.org/D109792, which disambiguated getBaseObject
(now getAliaseeObject) between GlobalIFunc and everything else.
In addition, as long as GlobalIFunc is not a GlobalObject and
getAliaseeObject returns GlobalObjects, a GlobalAlias whose aliasee
is a GlobalIFunc cannot currently be modeled properly. Creating
aliases for GlobalIFuncs does happen in the wild (e.g. glibc). In addition,
calling getAliaseeObject on a GlobalIFunc will currently return nullptr,
which is undesirable because it should return the object itself for
non-aliases.

This patch refactors the GlobalIFunc class to inherit directly from
GlobalObject, and removes GlobalIndirectSymbol (while inlining the
relevant parts into GlobalAlias and GlobalIFunc). This allows for
calling getAliaseeObject() on a GlobalIFunc to return the GlobalIFunc
itself, making getAliaseeObject() more consistent and enabling
alias-to-ifunc to be properly modeled in the IR.

I exercised some judgement in the API clients of GlobalIndirectSymbol:
some were 'monomorphized' for GlobalAlias and GlobalIFunc, and
some remained shared (with the type adapted to become GlobalValue).

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D108872
The file was modifiedllvm/include/llvm/IR/GlobalAlias.h
The file was removedllvm/include/llvm/IR/GlobalIndirectSymbol.h
The file was modifiedllvm/lib/Bitcode/Reader/BitcodeReader.cpp
The file was modifiedllvm/lib/Linker/IRMover.cpp
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
The file was modifiedllvm/include/llvm/CodeGen/AsmPrinter.h
The file was modifiedllvm/lib/IR/Globals.cpp
The file was modifiedllvm/lib/Transforms/Utils/ValueMapper.cpp
The file was modifiedllvm/lib/AsmParser/LLParser.cpp
The file was modifiedllvm/include/llvm/AsmParser/LLParser.h
The file was modifiedllvm/lib/Bitcode/Reader/MetadataLoader.cpp
The file was modifiedllvm/lib/Object/ModuleSymbolTable.cpp
The file was modifiedllvm/include/llvm-c/Core.h
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
The file was modifiedllvm/include/llvm/IR/Value.h
The file was modifiedllvm/lib/Transforms/Utils/SplitModule.cpp
The file was modifiedllvm/lib/Transforms/IPO/LowerTypeTests.cpp
The file was modifiedllvm/unittests/IR/ConstantsTest.cpp
The file was modifiedllvm/include/llvm/IR/GlobalIFunc.h
The file was modifiedllvm/include/llvm/Transforms/Utils/ValueMapper.h
The file was modifiedllvm/lib/IR/AsmWriter.cpp
The file was modifiedllvm/include/llvm/IR/GlobalObject.h
Commit 2caf7571e1020ae1024ab3f2d52ecc9aea85687d by Akira
[Clang][AST] Resolve FIXME: Remove ObjCObjectPointer from
isSpecifierType

There is no reason to have this here, (since all tests pass) and it
isn't even a specifier anyway. We can just treat it as a pointer
instead.

Differential Revision: https://reviews.llvm.org/D110068
The file was modifiedclang/lib/AST/DeclPrinter.cpp
The file was modifiedclang/lib/AST/Type.cpp
Commit 00500d5bad2270ea244adfdc6a48171968f88901 by aeubanks
[NFC] De-template LazyCallGraph::visitReferences() and move into .cpp file

This makes changing it and recompiling it much faster.
The file was modifiedllvm/lib/Analysis/LazyCallGraph.cpp
The file was modifiedllvm/include/llvm/Analysis/LazyCallGraph.h
Commit 6b82adbb4980593f4661edf94e5539adfe1a9f4e by muiez
Raise compile error when using unimplemented functions

The path functions in this patch are unimplemented (as per the TODO comment from upstream). To avoid running into a linker error (missing symbol), this patch raises a compile error by commenting out the functions, which is more user friendly.

Differential Revision: https://reviews.llvm.org/D111892
The file was modifiedlibcxx/include/filesystem
Commit 503d061dc7a8b36dba1df4bf083021a2482c6fb6 by Stanislav.Mekhanoshin
Precommit InstCombine/and-xor-or.ll test. NFC.
The file was modifiedllvm/test/Transforms/InstCombine/and-xor-or.ll
Commit fb8829768d774689c368c49cb3ca17339378cd91 by thakis
[clang] Disallow mixing SEH and Objective-C exceptions

We already disallow mixing SEH and C++ exceptions, and
mixing SEH and Objective-C exceptions seems to not work (see PR52233).
Emitting an error is friendlier than crashing.

Differential Revision: https://reviews.llvm.org/D112157
The file was modifiedclang/lib/Sema/SemaStmt.cpp
The file was addedclang/test/SemaCXX/exceptions-seh.mm
The file was modifiedclang/lib/Sema/ScopeInfo.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/include/clang/Sema/ScopeInfo.h
Commit 5692ed0cce8c9506eef40ffe6ca2d9629956c51c by blangmuir
[ORC-RT] Configure the ORC runtime for more architectures and platforms

Enable building the ORC runtime for 64-bit and 32-bit ARM architectures,
and for all Darwin embedded platforms (iOS, tvOS, and watchOS). This
covers building the cross-platform code, but does not add TLV runtime
support for the new architectures, which can be added independently.

Incidentally, stop building the Mach-O TLS support file unnecessarily on
other platforms.

Differential Revision: https://reviews.llvm.org/D112111
The file was modifiedcompiler-rt/lib/orc/elfnix_tls.x86-64.S
The file was modifiedcompiler-rt/lib/orc/CMakeLists.txt
The file was modifiedcompiler-rt/lib/orc/macho_tlv.x86-64.S
The file was modifiedcompiler-rt/lib/orc/simple_packed_serialization.h
The file was modifiedcompiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
The file was modifiedcompiler-rt/cmake/config-ix.cmake
Commit 80ab06c599a0f5a90951c36a57b2a9b492b19d61 by spatel
[InstCombine] fold fake vector insert to bit-logic

bitcast (inselt (bitcast X), Y, 0) --> or (and X, MaskC), (zext Y)

https://alive2.llvm.org/ce/z/Ux-662

Similar to D111082 / db231ebdb07f :
We want to avoid relatively opaque vector ops on types that are
likely supported by the backend as scalar integers. The bitwise
logic ops are more likely to allow further combining.

We probably want to generalize this to allow a shift too, but
that would oppose instcombine's general rule of not creating
extra instructions, so that's left as a potential follow-up.
Alternatively, we could do that transform in VectorCombine
with the help of the TTI cost model.

This is part of solving:
https://llvm.org/PR52057
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
The file was modifiedllvm/test/Transforms/InstCombine/bitcast-inselt-bitcast.ll
Commit 1412719066a6efdfdb35a400d589d84a0ef83f28 by thakis
[lld/mac] Remove else-after-return in ICF code

No behavior change.
The file was modifiedlld/MachO/ICF.cpp
Commit 5d57578a4e48e4b4cdd41533670a012ad265c8a1 by thakis
[MC] Recursively calculate symbol offset

This is speculative since I'm not sure if there's some implicit contract that a
variable symbol must not have another variable symbol in its evaluation tree.

Downstream bug: https://bugs.chromium.org/p/chromium/issues/detail?id=471146#c23.

Test is based on alias.s (removed checks since we just need to know it didn't
crash).

Differential Revision: https://reviews.llvm.org/D109109
The file was addedllvm/test/MC/MachO/chained-alias-offset.s
The file was modifiedllvm/lib/MC/MCFragment.cpp
Commit 618583565687f5a494066fc902a977f6057fc93e by Stanislav.Mekhanoshin
[AMDGPU] Allow rematerialization of SOP with virtual registers

D106408 was doing this for all targets although it was
reverted due to couple performance regressions on some targets.
The difference for AMDGPU is the ability to rematerialize SOP
instructions with virtual register uses like we already do for VOP.

Differential Revision: https://reviews.llvm.org/D110743
The file was modifiedllvm/test/CodeGen/AMDGPU/remat-sop.mir
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Commit c80d8a8ceabb5c42e0143d9507394068075538f9 by Stanislav.Mekhanoshin
[AMDGPU] MachineLICM cannot hoist VALU

MachineLoop::isLoopInvariant() returns false for all VALU
because of the exec use. Check TII::isIgnorableUse() to
allow hoisting.

That unfortunately results in higher register consumption
since MachineLICM does not adequately estimate pressure.
Therefor I think it shall only be enabled after D107677 even
though it does not depend on it.

Differential Revision: https://reviews.llvm.org/D107859
The file was modifiedllvm/test/CodeGen/AMDGPU/udiv64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/sdiv64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/infinite-loop.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/urem64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/indirect-call.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/srem64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/fp64-atomics-gfx90a.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/wave32.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/vgpr-descriptor-waterfall-loop-idom-update.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/dag-divergence-atomic.ll
The file was modifiedllvm/lib/CodeGen/MachineLoopInfo.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/global-atomics-fp.ll
Commit 207998c242c8c8a270ff22a5136da87338546725 by Jonas Devlieghere
[lldb] Remove variable "any" which is set but not used
The file was modifiedlldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
Commit b046eb19b8a42ffa3b4742e765cc013d3eefd6b5 by Jon Roelofs
[AArch64][GlobalISel] combine (and (or x, c1), c2) => (and x, c2) iff c1 & c2 == 0

https://godbolt.org/z/h8ejrG4hb

rdar://83597585

Differential Revision: https://reviews.llvm.org/D111856
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/combine-and-or-disjoint-mask.mir
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
Commit a3dd4e777095f9668215a3babab1041025819f64 by ataei
Drop transfer_read inner most unit dimensions

Add a pattern to take a rank-reducing subview and drop inner most
contiguous unit dim.
This is useful when lowering vector to backends with 1d vector types.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D111561
The file was addedmlir/test/Dialect/Vector/vector-transfer-collapse-inner-most-dims.mlir
The file was modifiedmlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp
The file was modifiedmlir/lib/Dialect/Vector/VectorTransforms.cpp
The file was modifiedmlir/include/mlir/Dialect/Vector/VectorTransforms.h
Commit 4e21caece0dd72450b6ac72d1bcedd697c666efc by erich.keane
Update ext-int test to have x86 linux/windows before ABI Impl

Writing a quick test to make sure we are aware of the change to the
_ExtInt/_BitInt ABI on x86 (32bit) OSes.
The file was modifiedclang/test/CodeGenCXX/ext-int.cpp
Commit 02d7089c239075a5c2e148087d2824d253fc3d5f by clementval
[fir] Add Character helper

This patch is extracted from D111337. It introduce the
CharacterExprHelper that helps dealing with character in FIR.

Reviewed By: schweitz, awarzynski

Differential Revision: https://reviews.llvm.org/D112140

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
The file was modifiedflang/include/flang/Optimizer/Dialect/FIRType.h
The file was addedflang/include/flang/Optimizer/Builder/Character.h
The file was modifiedflang/lib/Optimizer/Builder/CMakeLists.txt
The file was modifiedflang/lib/Optimizer/Builder/FIRBuilder.cpp
The file was modifiedflang/include/flang/Optimizer/Dialect/FIROpsSupport.h
The file was addedflang/unittests/Optimizer/Builder/CharacterTest.cpp
The file was modifiedflang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
The file was modifiedflang/unittests/Optimizer/CMakeLists.txt
The file was modifiedflang/include/flang/Optimizer/Builder/FIRBuilder.h
The file was addedflang/lib/Optimizer/Builder/Character.cpp
Commit 35037ae1971a92b07783339ee9d7a5da50a2ab4b by erich.keane
Make dr177x.cpp test work with Windows-32 bit platfroms with 'thiscall'.

My downstream noticed that the test failed on windows-32 bit machines
since the types have __attribute__((thiscall)) on them in a few places.
This patch just adds a wildcard to handle that, since it isn't
particularly important to the test.
The file was modifiedclang/test/CXX/drs/dr177x.cpp
Commit bd5494d127a39f619b7d0e5e967f190e0e61d6e7 by ajcbik
[mlir][sparse] make index type explicit in public API of support library

The current implementation used explicit index->int64_t casts for some, but
not all instances of passing values of type "index" in and from the sparse
support library. This revision makes the situation more consistent by
using new "index_t" type at all such places  (which allows for less trivial
casting in the generated MLIR code).  Note that the current revision still
assumes that "index" is 64-bit wide. If we want to support targets with
alternative "index" bit widths, we need to build the support library different.
But the current revision is a step forward by making this requirement explicit
and more visible.

Reviewed By: wrengr

Differential Revision: https://reviews.llvm.org/D112122
The file was modifiedmlir/test/Dialect/SparseTensor/conversion.mlir
The file was modifiedmlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
The file was modifiedmlir/lib/ExecutionEngine/SparseUtils.cpp
Commit 8977bd58067d9dcd5e8cebd078c45ff629af9e1d by flo
[IndVars] Invalidate SCEV when IR is changed in rewriteLoopExitValue.

At the moment, rewriteLoopExitValue forgets the current phi node in the
loop that collects phis to rewrite. A few lines after the value is
forgotten, SCEV is used again to analyze incoming values and
potentially expand SCEV expression. This means that another SCEV is
created for PN, before the IR is actually updated in the next loop.

This leads to accessing invalid cached expression in combination with
D71539.

PN should only be changed once the actual incoming exit value is set in
the next loop. Moving invalidation there should ensure that PN is
invalidated in all relevant cases.

Reviewed By: mkazantsev

Differential Revision: https://reviews.llvm.org/D111495
The file was modifiedllvm/test/Transforms/IndVarSimplify/elim-extend.ll
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedllvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll