Kiran Chandramohan [Thu, 18 Aug 2022 14:34:45 +0000 (14:34 +0000)]
[Flang][OpenMP] Provide an error when the minus operator is used in a reduction
OpenMP 5.2 standard has deprecated the usage of the minus operation in
reductions. The minus operation also is an unpleasant feature with
varied interpretations.
The patch also changes the usage of the minus operator in some existing testcases.
Discussed in https://discourse.llvm.org/t/openmp-runtime-problem-with-subtraction-reduction/64404
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D132060
Simon Pilgrim [Thu, 18 Aug 2022 14:25:27 +0000 (15:25 +0100)]
[CostModel][X86] Add cost kinds test coverage for integer comparisons
Nikolas Klauser [Wed, 17 Aug 2022 15:01:02 +0000 (17:01 +0200)]
[libc++][NFC] Add a short description for __split_buffer
Reviewed By: Mordante, huixie90, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D132032
Philip Reames [Thu, 18 Aug 2022 14:08:39 +0000 (07:08 -0700)]
[LV] Restructure isPredicatedInst and isScalarWithPredication (w/a fix for uniform mem ops)
This change reorganizes the code and comments to make the expected semantics of these routines more clear. However, this is *not* an NFC change. The functional change is having isScalarWithPredication return false if the instruction does not need predicated. Specifically, for the case of a uniform memory operation we were previously considering it *not* to be a predicated instruction, but *were* considering it to be scalable with predication.
As can be seen with the test changes, this causes uniform memory ops which should have been lowered as uniform-per-parts values to instead be lowering via naive scalarization or if scalarization is infeasible (i.e. scalable vectors) aborted entirely. I also don't trust the code to bail out correctly 100% of the time, so it's possible we had a crash or miscompile from trying to scalarize something which isn't scalaralizable. I haven't found a concrete example here, but I am suspicious.
Differential Revision: https://reviews.llvm.org/D131093
Christian Kandeler [Thu, 18 Aug 2022 14:12:50 +0000 (16:12 +0200)]
[clangd] Use the "macro" semantic token for pre-defined identifiers
This matches user expectations.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D131175
Peter Steinfeld [Wed, 17 Aug 2022 23:54:34 +0000 (16:54 -0700)]
[Flang] Mark 128 float MODULO intrinsic calls as "TODO"
The code generated for this version of the intrinsic is broken. I'm
marking it as a "TODO" for now so that people don't get unannounce bad
results.
Differential Revision: https://reviews.llvm.org/D132082
Simon Pilgrim [Thu, 18 Aug 2022 13:18:54 +0000 (14:18 +0100)]
[CostModel][X86] getArithmeticInstrCost - use MUL/DIV/REM expansions for all cost kinds
The costs tables still assume throughput, but the general expansion patterns should be good for any cost kind
Simon Pilgrim [Thu, 18 Aug 2022 12:48:42 +0000 (13:48 +0100)]
[CostModel][X86] Add cost kinds test coverage for integer division/remainder operators
Martin Storsjö [Thu, 28 Jul 2022 10:54:43 +0000 (13:54 +0300)]
[clang-tidy] Rename a local cmake variables to match the new tool name. NFC.
This shouldn't have any externally visible effect.
This matches the new name from
18b4a8bcf3553174f770f09528c9bd01c8cebfe7.
Differential Revision: https://reviews.llvm.org/D130701
Simon Pilgrim [Thu, 18 Aug 2022 10:55:23 +0000 (11:55 +0100)]
[CostModel] Replace getUserCost with getInstructionCost
* Replace getUserCost with getInstructionCost, covering all cost kinds.
* Remove getInstructionLatency, it's not implemented by any backends, and we should fold the functionality into getUserCost (now getInstructionCost) to make it easier for targets to handle the cost kinds with their existing cost callbacks.
Original Patch by @samparker (Sam Parker)
Differential Revision: https://reviews.llvm.org/D79483
Ties Stuij [Thu, 18 Aug 2022 10:25:07 +0000 (11:25 +0100)]
[Clang] Propagate const context info when emitting compound literal
This patch fixes a crash when trying to emit a constant compound literal.
For C++ Clang evaluates either casts or binary operations at translation time,
but doesn't pass on the InConstantContext information that was inferred when
parsing the statement. Because of this, strict FP evaluation (-ftrapping-math)
which shouldn't be in effect yet, then causes checkFloatingpointResult to return
false, which in tryEmitGlobalCompoundLiteral will trigger an assert that the
compound literal wasn't constant.
The discussion here around 'manifestly constant evaluated contexts' was very
helpful to me when trying to understand what LLVM's position is on what
evaluation context should be in effect, together with the explanatory text in
that patch itself:
https://reviews.llvm.org/D87528
Reviewed By: rjmccall, DavidSpickett
Differential Revision: https://reviews.llvm.org/D131555
wanglian [Thu, 18 Aug 2022 09:06:11 +0000 (17:06 +0800)]
Precommit tests for D132115
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D132116
Dmitry Preobrazhensky [Thu, 18 Aug 2022 09:50:29 +0000 (12:50 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing tests for DS opcodes
Differential Revision: https://reviews.llvm.org/D132026
Matthias Springer [Thu, 18 Aug 2022 09:43:20 +0000 (11:43 +0200)]
[mlir][SCF] Loop lb/ub are symbols during Affine Min/Max canonicalization
This fixes a bug in SCF/AffineCanonicalizationUtils.cpp. Loop lb/ub were previously considered dimensions, which caused a crash when a (non-optimizable) affine.min / affine.max expression was processed (due to multiplication of two dims). Lb/ub are now considered symbols and symbols may be multiplied. (The scope of the analysis is "within the loop body", at which point lb/ub are constants.)
Differential Revision: https://reviews.llvm.org/D132021
Simon Pilgrim [Thu, 18 Aug 2022 09:43:21 +0000 (10:43 +0100)]
[Transforms] LICM.cpp - pull out repeated getUserCost call
Pulled out of D79483
Simon Pilgrim [Thu, 18 Aug 2022 09:41:15 +0000 (10:41 +0100)]
[Analysis] CostModel.cpp - merge isa<IntrinsicInst> and dyn_cast<IntrinsicInst> checks
Pulled out of D79483
Dmitry Preobrazhensky [Thu, 18 Aug 2022 09:37:27 +0000 (12:37 +0300)]
[AMDGPU][MC][GFX10][NFC] Split large test
Split gfx10_dasm_all.txt by encoding.
Differential Revision: https://reviews.llvm.org/D132044
Matthias Springer [Thu, 18 Aug 2022 08:11:39 +0000 (10:11 +0200)]
[mlir][bufferize] Better error handling: Fail if ToMemrefOps are found
bufferization.to_memref ops are not supported in One-Shot Analysis. They often trigger a failed assertion that can be confusing. Instead, scan for to_memref ops before running the analysis and immediately abort with a proper error message.
Differential Revision: https://reviews.llvm.org/D132027
zhongyunde [Thu, 18 Aug 2022 09:31:19 +0000 (17:31 +0800)]
[NFC][AArch64] precommit sched model for tsv110
Part of the schedule model is not accurate, so need a initial test record the changes.
This assemble list is refer to the basic part of D128631
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D132103
Mats Petersson [Wed, 17 Aug 2022 17:55:48 +0000 (18:55 +0100)]
[MLIR][NFC] Sort table of operations alphabetically
Arrange the operations in alphabetical order, rather than what
appears to be the order they were added. This was suggested in
a review when adding new operations.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D132046
Rainer Orth [Thu, 18 Aug 2022 09:26:07 +0000 (11:26 +0200)]
[mlir][test] Require JIT support in JIT tests
A number of mlir tests `FAIL` on Solaris/sparcv9 with `Target has no JIT
support`. This patch fixes that by mimicing `clang/test/lit.cfg.py` which
implements a `host-supports-jit` keyword for this. The gtest-based unit
tests don't support `REQUIRES:`, so lack of support needs to be hardcoded
there.
Tested on `amd64-pc-solaris2.11` (`check-mlir` results unchanged) and
`sparcv9-sun-solaris2.11` (only one unrelated failure left).
Differential Revision: https://reviews.llvm.org/D131151
Uday Bondhugula [Wed, 17 Aug 2022 04:23:54 +0000 (09:53 +0530)]
[MLIR] Remove hardcoded usage of alloc/dealloc; use memory effects
Remove hardcoded usage of memref.alloc/dealloc ops in affine utils; use memory
effects instead. This is NFC for existing test cases, but strictly more
general/powerful in terms of functionality: it allows other allocation and
freeing ops (like gpu.alloc/dealloc) to work in conjunction with affine ops and
utilities.
Differential Revision: https://reviews.llvm.org/D132011
Güray Özen [Mon, 15 Aug 2022 15:14:12 +0000 (15:14 +0000)]
[mlir][Vector] Support 0-D vectors in ReductionOp
This commit adds support for 0-D vectors in ReductionOp.
Reviewed By: nicolasvasilache, dcaballe
Differential Revision: https://reviews.llvm.org/D131896
Haohai Wen [Thu, 18 Aug 2022 08:37:41 +0000 (16:37 +0800)]
[X86] Add schedule module for Alderlake-P
The X86SchedAlderlakeP.td file is automatically generated by schedtool
(D130897). Most of instruction's scheduling information is based on
measured ADL-P data in uops.info. Some data is from GLC tpt/lat data
provided by intel doc. The rest instruction's scheduling information is
from skylake client schedule model in order to get a relative complete
model.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D130959
Utkarsh Saxena [Wed, 17 Aug 2022 14:44:41 +0000 (16:44 +0200)]
Do not evaluate dependent immediate invocations
We deferred the evaluation of dependent immediate invocations in https://reviews.llvm.org/D119375 until instantiation.
We should also not consider them referenced from a non-consteval context.
Fixes: https://github.com/llvm/llvm-project/issues/55601
```
template<typename T>
class Bar {
consteval static T x() { return 5; }
public:
Bar() : a(x()) {}
private:
int a;
};
Bar<int> g();
```
Is now accepted by clang. Previously it errored with: `cannot take address of consteval function 'x' outside of an immediate invocation Bar() : a(x()) {}`
Differential Revision: https://reviews.llvm.org/D132031
Vitaly Buka [Wed, 17 Aug 2022 20:44:53 +0000 (13:44 -0700)]
[tsan] Keep thread/stack for closed FD
Fixes b/
242869837
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D132068
Petr Hosek [Thu, 18 Aug 2022 08:22:43 +0000 (08:22 +0000)]
Revert "[Driver] Support libc++ in MSVC"
This reverts commit
a4230319f7af786f4d947f39a870f339b32a6fe7.
This is causing build failures in the 2-stage build.
gonglingqin [Thu, 18 Aug 2022 07:37:12 +0000 (15:37 +0800)]
[LoongArch] Supports brcond with 21 bit offsets
Differential Revision: https://reviews.llvm.org/D132006
wanglian [Thu, 18 Aug 2022 07:09:21 +0000 (15:09 +0800)]
[DAGCombiner][NFC] Tidy up unnecessary brackets in visitADD.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D132107
Daniel Bertalan [Fri, 12 Aug 2022 13:10:58 +0000 (15:10 +0200)]
[llvm-objdump] Support dumping segment information with -chained_fixups
This commit adds the definitions for `dyld_chained_starts_in_image`,
`dyld_chained_starts_in_segment`, and related enums. Dumping their
contents is possible with the -chained_fixups flag of llvm-otool.
The chained-fixups.yaml test was changed to cover bindings/rebases, as
well as weak imports, weak symbols and flat namespace symbols. Now that
we have actual fixup entries, the __DATA segment contains data that
would need to be hexdumped in YAML. We also test empty pages (to look
for the "DYLD_CHAINED_PTR_START_NONE" annotation), so the YAML would end
up quite large. So instead, this commit includes a binary file.
When Apple's effort to upstream their chained fixups code continues,
we'll replace this code with the then-upstreamed code. But we need
something in the meantime for testing ld64.lld's chained fixups code.
Differential Revision: https://reviews.llvm.org/D131961
David Blaikie [Thu, 18 Aug 2022 07:11:52 +0000 (07:11 +0000)]
Add missing bazel dep
Vitaly Buka [Wed, 17 Aug 2022 18:49:38 +0000 (11:49 -0700)]
[test] Add 'hwasan' feature and disable a test
Vitaly Buka [Thu, 18 Aug 2022 06:35:15 +0000 (23:35 -0700)]
[test][Sema] Ignore stderr in test
Mixing stdout and stderr may break lines we try to match.
Valentin Clement [Thu, 18 Aug 2022 05:53:26 +0000 (07:53 +0200)]
[flang] Add specific TODO for the REDUCE instrinsic
Add a proper TODO for the REDUCE instrinsic instead of crashing.
Reviewed By: PeteSteinfeld, vdonaldson
Differential Revision: https://reviews.llvm.org/D132020
WANG Xuerui [Thu, 18 Aug 2022 05:08:19 +0000 (13:08 +0800)]
[LoongArch] Add support for llvm.eh.dwarf.cfa
It's the same as D126181 for RISCV.
Differential Revision: https://reviews.llvm.org/D132012
Timm Bäder [Fri, 5 Aug 2022 11:57:39 +0000 (13:57 +0200)]
[clang][Interp] Implement boolean and nullptr literals
Handle CXX bool literals as well as nullptr literals and add a few tests
for each.
Differential Revision: https://reviews.llvm.org/D131942
WuXinlong [Tue, 16 Aug 2022 01:23:02 +0000 (09:23 +0800)]
[RISCV] Add MC support of RISCV Zca Extension
This patch adds support for part of Zc extension which will be frozen soon.
This extension is designed to continue reducing the binary size of RISC-V programs.
In this patch:
`Zca` is a subset of C extension instructions that are compatible with the Zc extension.
The spec of Zc ext is [[ https://github.com/riscv/riscv-code-size-reduction/releases | Here ]]
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D130141
Petr Hosek [Thu, 18 Aug 2022 03:33:34 +0000 (03:33 +0000)]
[Driver] Support libc++ in MSVC
This implements support for using libc++ headers in MSVC toolchain.
We only support libc++ headers that are part of the toolchain, and
not headers installed elsewhere on the system.
Differential Revision: https://reviews.llvm.org/D101479
Amir Ayupov [Thu, 18 Aug 2022 03:45:05 +0000 (20:45 -0700)]
[BOLT][NFC] Reformat strings in handleRelocation
With reduced indentation, some strings can be reformatted to take less lines.
Also strategically apply `formatv` to shorten them.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132088
Amir Ayupov [Thu, 18 Aug 2022 03:43:21 +0000 (20:43 -0700)]
[BOLT][NFC] Split out handleRelocation
Split out the body of a for-loop in `RewriteInstance::readRelocations` into a
separate function (`handleRelocation`). It's still over 300 lines of code,
so it's worth splitting down further.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132078
wanglian [Tue, 16 Aug 2022 06:23:38 +0000 (14:23 +0800)]
[DAGCombiner][NFC] Merge two if statement into one.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D131941
Vitaly Buka [Thu, 18 Aug 2022 01:44:41 +0000 (18:44 -0700)]
[test] Propagate HWASAN_OPTIONS
Vitaly Buka [Sat, 13 Aug 2022 20:10:40 +0000 (13:10 -0700)]
[NFC][OpenMP] Simplify
2f9be69d843
Konstantina [Mon, 1 Aug 2022 05:25:32 +0000 (22:25 -0700)]
[NewGVN][PHIOFOPS] Bail out if an operand is in OpSafeForPHIOfOps but it is not safe for the current basic block.
NewGVN tables are not cleared out between the initial run of NewGVN and the verification. In case of phi-of-ops optimization, OpSafeForPHIOfOps goes out of sync between the two runs. One operand might not be safe for one basic block, but it might be safe for one of its successors. In this case, the operand will be added in OpSafeForPHIOfOps map. In verification phase, we reuse OpSafeForPHIOfOps without updating it again. As a result, the operand will be considered safe for phi-of-ops optimization even for the case that it is not. This patch fixes this problem.
Fix for 53807.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D130910
Jakub Kuderski [Thu, 18 Aug 2022 01:32:00 +0000 (21:32 -0400)]
[mlir][spirv] Add arith.addi_carry to spv.IAddCarry conversion
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D131908
Lang Hames [Thu, 18 Aug 2022 00:46:37 +0000 (17:46 -0700)]
[ORC][MachO] Fix MachOPlatform after
9189a26664b.
Commit
9189a26664b caused llvm-jitlink to create bare JITDylibs to wrap real
dylibs loaded via -preload. This exposed a bug in MachOPlatform where we
assumed that all JITDylibs had been registered with the platform through
MachOPlatform::setupJITDylib (bare JITDylibs are _not_ run through this
function), and errored out where this was not the case.
This bug in MachOPlatform was causing test failures in compilert-rt:
Failed Tests (2):
ORC-x86_64-darwin :: TestCases/Darwin/x86-64/trivial-objc-methods.S
ORC-x86_64-darwin :: TestCases/Darwin/x86-64/trivial-swift-types-section.S
This commit fixes the issue by skipping JITDylibs that haven't been registered
with the platform via MachOPlatform::setupJITDylib.
Sam Clegg [Thu, 18 Aug 2022 00:54:03 +0000 (17:54 -0700)]
[WebAssembly] WebAssemblyLowerEmscriptenEHSjLj: Fix signature of malloc in wasm64 mode
Differential Revision: https://reviews.llvm.org/D132091
Amir Ayupov [Thu, 18 Aug 2022 00:37:13 +0000 (17:37 -0700)]
[BOLT][UTILS] Add nfc-check-setup --switch-back option
Add an option to switch repo revision back, handling stashing automatically.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D128243
Aart Bik [Wed, 17 Aug 2022 23:59:08 +0000 (16:59 -0700)]
[mlir][sparse] more concise sparse tensor type printing
This change omits default values from the sparse tensor type,
saving considerable text real estate for the common cases.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D132083
Amir Ayupov [Thu, 18 Aug 2022 00:34:49 +0000 (17:34 -0700)]
[BOLT][NFC] Simplify debug logging in case of JT heuristic failure
Move logging into LLVM_DEBUG scope.
Remove redundant printing of jump table parents:
Old logging:
```
failed to analyze jump table in function _ZN12_GLOBAL__N_116InitHeaderSearch23Ad
dDefaultCIncludePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1(*2)
PIC Jump table JUMP_TABLE/_ZN12_GLOBAL__N_116InitHeaderSearch23AddDefaultCInclud
ePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1.1 for function _ZN12_GL
OBAL__N_116InitHeaderSearch23AddDefaultCIncludePathsERKN4llvm6TripleERKN5clang19
HeaderSearchOptionsE/1(*2) at 0x65996e0 with a total count of 0:
0x9dc
next jump table at 0x659a810 belongs to function _ZN5clang5Lexer40LexDependencyD
irectiveTokenWhileSkippingERNS_5TokenE
PIC Jump table JUMP_TABLE/_ZN5clang5Lexer40LexDependencyDirectiveTokenWhileSkipp
ingERNS_5TokenE.0 for function _ZN5clang5Lexer40LexDependencyDirectiveTokenWhile
SkippingERNS_5TokenE at 0x659a810 with a total count of 0:
jump table heuristic failure
```
New logging:
```
failed to analyze PIC Jump table JUMP_TABLE/_ZN12_GLOBAL__N_116InitHeaderSearch2
3AddDefaultCIncludePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1.1 for
function _ZN12_GLOBAL__N_116InitHeaderSearch23AddDefaultCIncludePathsERKN4llvm6T
ripleERKN5clang19HeaderSearchOptionsE/1(*2) at 0x65996e0 with a total count of 0:
absolute offset: 0x52ac58c
next PIC Jump table JUMP_TABLE/_ZN5clang5Lexer40LexDependencyDirectiveTokenWhile
SkippingERNS_5TokenE.0 for function _ZN5clang5Lexer40LexDependencyDirectiveToken
WhileSkippingERNS_5TokenE at 0x659a810 with a total count of 0:
jump table heuristic failure
```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131243
Amir Ayupov [Thu, 18 Aug 2022 00:33:38 +0000 (17:33 -0700)]
[BOLT][NFC] Simplify scanExternalRefs
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132013
Alexander Yermolovich [Thu, 18 Aug 2022 00:29:38 +0000 (17:29 -0700)]
[BOLT][DWARF] Handle zero size DW_TAG_inlined_subroutine
We were resetting DW_AT_low_pc to zero when DW_AT_high_pc was zero, or
DW_AT_low_pc == DW_AT_high_pc. This resulted in LLDB to print error "adding
range [0x0-0x0) which has a base that is less than the function's low PC".
Changed it so that when this case arises we set DW_AT_low_pc to the start
address.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132059
Luo, Yuanke [Tue, 16 Aug 2022 00:19:21 +0000 (08:19 +0800)]
[amdgpu] Change the RA to basic
Specifying `-regalloc=fast` is not reliable. With fast register allocation,
`LIS = getAnalysisIfAvailable<LiveIntervals>();` get nullptr
in "si-lower-sgpr-spills" pass, so the slot index is not created in the
pass for new inserted instructions. When verifying the machine
instructions, it fails on checking slot index. While greedy-ra is time
consuming basic-ra can be used to reduce compiling time for this test case.
Differential Revision: https://reviews.llvm.org/D131931
Jacques Pienaar [Thu, 18 Aug 2022 00:00:47 +0000 (17:00 -0700)]
[mlir] Update when to check for non-null optional default attr
OptionalAttr does the wrapping with Optional explicitly in ODS while
default valued optional attribute doesn't (and follows DefaultValuedAttr
in this behavior/meant as drop-in for updating old behavior), update
when to emit check for non-null to account for this. Also add variant
for optional default valued string attribute to have same convenience as
default valued string attribute.
Fabian Parzefall [Wed, 17 Aug 2022 23:34:43 +0000 (16:34 -0700)]
[BOLT] Fix ignored LP at fragment start
If the first block of a fragment is also a landing pad, the landing pad
is not used if an exception is thrown. This is because the landing pad
is at the same start address that the corresponding LSDA describes. In
that case, the offset in the call site records to refer to that landing
pad is zero, and a zero offset is interpreted by the personality
function as "no handler" and ignored.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D132053
Amir Ayupov [Wed, 17 Aug 2022 23:28:22 +0000 (16:28 -0700)]
[BOLT][NFC] Move printRelocationInfo into a method
Move this large lambda out of readRelocations into a standalone method.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131812
Jeffrey Byrnes [Wed, 20 Jul 2022 19:42:11 +0000 (12:42 -0700)]
[AMDGPU] Implement pipeline solver for non-trivial pipelines
Requested SchedGroup pipelines may be non-trivial to satisify. A minimimal example is if the requested pipeline is {2 VMEM, 2 VALU, 2 VMEM} and the original order of SUnits is {VMEM, VALU, VMEM, VALU, VMEM}. Because of existing dependencies, the choice of which SchedGroup the middle VMEM goes into impacts how closely we are able to match the requested pipeline. It seems minimizing the degree of misfit (as measured by the number of edges we can't add) w.r.t the choice we make when mapping an instruction -> SchedGroup is an NP problem. This patch implements the PipelineSolver class which produces a solution for the defined problem for the sched_group_barrier mutation. The solver has both an exponential time exact algorithm and a greedy algorithm. The patch includes some controls which allows the user to select the greedy/exact algorithm.
Differential Revision: https://reviews.llvm.org/D130797
Jacques Pienaar [Wed, 17 Aug 2022 22:08:37 +0000 (15:08 -0700)]
[mlir] add missing pessimistic setting
This is updated on https://reviews.llvm.org/D127139, to mark op with region as pessimistic.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D131480
Siva Chandra Reddy [Wed, 17 Aug 2022 23:18:05 +0000 (23:18 +0000)]
[libc][Obvious] Update the static archive target name for libc-api-test.
Slava Gurevich [Tue, 16 Aug 2022 21:09:46 +0000 (14:09 -0700)]
[LLDB][NFC] Suppress spurious static inspection warnings
Suppress coverity false positives.
This diff contains comments only, including the hints for Coverity static code inspection
to suppress the warning originating at the next line after the comment.
Differential Revision: https://reviews.llvm.org/D131998
root [Wed, 17 Aug 2022 23:11:28 +0000 (19:11 -0400)]
[MLIR] Add dealloc alias check to bufferization
Traverse the cloneOp for aliases to find the alloc op
Reviewed By: frgossen, bondhugula
Differential Revision: https://reviews.llvm.org/D131797
Amir Ayupov [Wed, 17 Aug 2022 22:52:40 +0000 (15:52 -0700)]
[BOLT][NFC] Simplify addRelocation
Move the implementation out of the header file.
Simplify the method.
Add debug logging.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131811
owenca [Wed, 17 Aug 2022 04:03:52 +0000 (21:03 -0700)]
[clang-format] Handle return type auto followed by l_paren
Fixes #57160.
Differential Revision: https://reviews.llvm.org/D132008
Alexander Yermolovich [Wed, 17 Aug 2022 23:04:34 +0000 (16:04 -0700)]
[DWARF][BOLT] Handle getBinaryFunctionContainingAddress returning nullptr for DW_TAG_call_site
DW_TAG_call_site/DW_AT_call_return_pc can contain address that is not in any
function. In this case getBinaryFunctionContainingAddress returns nullptr. For
this case preserving original address.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132057
Lang Hames [Mon, 8 Aug 2022 04:55:03 +0000 (21:55 -0700)]
[JITLink] Fix typo in block address in unittest.
The address isn't currently used in this test but overlaps with Block B1,
which is a dubious state for a LinkGraph to be in.
Lang Hames [Tue, 2 Aug 2022 01:41:47 +0000 (15:41 -1000)]
[JITLink] Pass Allocator (rather than storage) into Symbol named constructors.
Also switch from orc::ExecutorAddrDiff to uint64_t for the Symbol::Size field.
These changes help to prepare for the introduction of symbol alias support:
Aliases will require an auxiliary data structure which will also need to be
allocated (hence the need to pass the allocator down). The Size field will be
re-tasked to track the auxiliary data (which will hold a replacement Size field)
if the symbol is either an alias, or aliased by some other symbol.
Lang Hames [Wed, 27 Jul 2022 17:56:22 +0000 (10:56 -0700)]
[JITLink][MachO] Add support for non-subsections-via-symbols objects.
This patch updates MachOLinkGraphBuilder to honor the MH_SUBSECTIONS_VIA_SYMBOLS
flag. Prior to this patch we assumed MH_SUBSECTIONS_VIA_SYMBOLS, but never
checked the flag.
If MH_SUBSECTIONS_VIA_SYMBOLS is set (the default for MachO output on modern
compilers) then MachOLinkGraphBuilder will break MachO section content into
jitlink::Blocks on symbol boundaries. (This is how JITLink has always handled
MachO sections previously).
If MH_SUBSECTIONS_VIA_SYMBOLS is not set then MachOLinkGraphBuilder will create
a single jitlink::Block for each MachO section.
Existing hand-written testcases that were _not_ using the
.subsections_via_symbols directive are updated to use it. A new testcase for
non-subsections-via-symbols behavior is included.
Siva Chandra Reddy [Tue, 16 Aug 2022 20:27:31 +0000 (20:27 +0000)]
[libc] Add a target to install libc in the full build mode.
* In the full build mode, `ninja install-libc` will install the headers as
well the static archive named libc.a.
* In the default mode, `ninja install-llvmlibc` will only install the
static archive libllvmlibc.a.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D132015
Fabian Parzefall [Wed, 17 Aug 2022 22:06:15 +0000 (15:06 -0700)]
[BOLT] Remove old layout from function layout
To track whether a function's new layout is different from its old
layout when updating it, the old layout would be kept around in memory
indefinitely (if the new layout is different). This was used only for
debugging/logging purposes. This patch forces the caller of function
layout's update method to copy the old layout into a temporary if they
need it by removing the old layout fields.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131413
Fabian Parzefall [Wed, 17 Aug 2022 21:51:29 +0000 (14:51 -0700)]
[BOLT] Add main fragment to function layout
Functions that do not contain any code still have to be emitted. This
occurs on AArch64 where functions can consist only of a constant island.
To support fragment semantics in code emission, this commits adds a
guaranteed main fragment to function layout. This fragment might be
empty, but allows us omit checks whether the function is empty in most
places.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130051
Daniil Fukalov [Wed, 17 Aug 2022 21:38:34 +0000 (00:38 +0300)]
[NFCI] Move cost estimation from TargetLowering to TargetTransformInfo.
TragetLowering had two last InstructionCost related `getTypeLegalizationCost()`
and `getScalingFactorCost()` members, but all other costs are processed in TTI.
E.g. it is not comfortable to use other TTI members in these two functions
overrided in a target.
Minor refactoring: `getTypeLegalizationCost()` now doesn't need DataLayout
parameter - it was always passed from TTI.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D117723
Paul Kirth [Wed, 17 Aug 2022 20:57:59 +0000 (20:57 +0000)]
[libcxx] Fix using the vcruntime ABI with _HAS_EXCEPTIONS=0 defined
_HAS_EXCEPTIONS=0 allows disabling the exception parts of the MS STL
and vcruntime, and e.g. compiler-rt/lib/fuzzer sets this define (to
work around issues with MS STL). If using libc++ instead of MS STL,
this define previously broke the libc++ headers.
If _HAS_EXCEPTIONS is set to 0, the vcruntime_exception.h header
doesn't define the ABI base class std::exception. If no exceptions
are going to be thrown, this probably is fine (although it also
breaks using subclasses of it as regular objects that aren't thrown),
but it requires ifdeffing out all subclasses of all exception/error
derived objects (which are sprinkled throughout the headers).
Instead, libc++ will supply an ABI compatible definition when
_HAS_EXCEPTIONS is set to 0, which will make the class hierarchies
complete.
In this build configuration, one can still create instances of
exception subclasses, and those objects will be ABI incompatible
with the ones from when _HAS_EXCEPTIONS isn't defined to 0 - but
one may argue that's a pathological/self-imposed problem in that case.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D103947
Shafik Yaghmour [Wed, 17 Aug 2022 20:54:14 +0000 (13:54 -0700)]
[Clang] Tighten restrictions on enum out of range diagnostic to avoid constant initialization
The restrictions added in D131704 were not sufficient to avoid all non-constant
expression contexts. In particular constant initialization cases.
We need to check EvaluatingDecl to detect if the variable we are initializing is
constexpr or not.
At this point it looks like this is the remaining case affecting various projects
with this diagnostic.
Differential Revision: https://reviews.llvm.org/D131874
Philip Reames [Wed, 17 Aug 2022 20:58:56 +0000 (13:58 -0700)]
[tests] Precommit tests for phi recusion limits in known bits
Jakub Kuderski [Wed, 17 Aug 2022 20:31:30 +0000 (16:31 -0400)]
[mlir] Add arith.addi_carry op
The `arith.addi_carry` op implements integer addition with overflows. The carry is returned via the second result, as `i1`.
Reviewed By: antiagainst, bondhugula
Differential Revision: https://reviews.llvm.org/D131893
Vitaly Buka [Wed, 17 Aug 2022 20:52:13 +0000 (13:52 -0700)]
[NFC][tsan] Use AddThread(Tid tid...
Slava Zakharin [Thu, 11 Aug 2022 02:40:01 +0000 (19:40 -0700)]
[flang] Control SUM simplification with a pass option.
The current code may not always work correctly, e.g.:
https://github.com/llvm/llvm-project/issues/57201
I added 'enable-experimental' pass option so that SUM simplification
may be enabled in LIT tests, but it is not enabled when the pass
is added to the passes pipeline.
Differential Revision: https://reviews.llvm.org/D131640
Zequan Wu [Fri, 29 Jul 2022 19:35:22 +0000 (12:35 -0700)]
[LLDB][NativePDB] Switch to use DWARFLocationList.
Before, NativePDB uses scoped range as a workaround for value range, that causes
problems (e.g. a variable's value can only have one range, but usually a
variable's value is located at different address ranges, each at different
locations, in optimized build).
This patch let NativePDB switch to DWARFLocationList so a variable's value can
be described at multiple non-overlapped address ranges and each range maps to a
location.
Because overlapping ranges exists, here's peference when choosing ranges:
1. Always prefer whole value locations. Suppose a variable size is 8 bytes, one record is that for range [1, 5) first 4 bytes is at ecx, and another record is that for range [2, 8) the 8 bytes value is at rdx. This results: [1, 2) has first 4 bytes at ecx, [2, 8) has the whole value at rdx.
2. Always prefer the locations parsed later. Suppose first record is that for range [1, 5) value is at ecx, second record is that for range [2, 6) value is at eax. This results: [1, 2) -> ecx, [2, 6) -> eax.
Differential Revision: https://reviews.llvm.org/D130796
Sanjay Patel [Wed, 17 Aug 2022 18:56:33 +0000 (14:56 -0400)]
[SDAG] avoid generating libcall to function with same name
This is a potentially better alternative to D131452 that also
should avoid the infinite loop bug from:
issue #56403
This is again a minimal fix to reduce merging pain for the
release. But if this makes sense, then we might want to guard
all of the RTLIB generation (and other libcalls?) with a
similar name check.
Differential Revision: https://reviews.llvm.org/D131521
Markus Böck [Wed, 17 Aug 2022 20:17:58 +0000 (22:17 +0200)]
[mlir][ODS] Add `constBuilderCall` to `Dense*ArrayAttr`s
These are useful in builders of Ops taking DenseArrayAttrs or for use in Rewriter, to create constant instances.
Differential Revision: https://reviews.llvm.org/D132067
Matthias Braun [Mon, 15 Aug 2022 21:45:22 +0000 (14:45 -0700)]
RAGreedyStats: Ignore identity COPYs; count COPYs from/to physregs
Improve copy statistics:
- Count copies from or to physical registers: They are used to model function parameters and calling conventions and the register allocator optimizes for them.
- Check physical registers assigned to virtual registers and stop counting "identity" `COPY`s where source and destination is the same physical registers; they will be removed in the `virtregmap` pass anyway.
Differential Revision: https://reviews.llvm.org/D131932
Archit Saxena [Wed, 17 Aug 2022 19:13:27 +0000 (12:13 -0700)]
Split EH code by default
The current machine function splitter is reliant on profile data to do profile summary analysis to split blocks into cold section. This may sometimes limit the usage of machine function splitter especially in cases where we could do some form of static analysis to split out cold blocks if profile data is absent or profile data which may be faulty (Consider Sample PGO).
Of all code that could statically be marked cold Exception handling blocks are one of them (In fact BFI framework also tends to mark them as cold), and the most in size contribution. In my experiments I found out Exception handling pads and all code reachable from there account for up to 6-8% of the .text section on modern production binaries. This patch introduces a flag to split out all Exception handling blocks and blocks only reachable from Exceptional Handling pad to cold section. This flag has shown to give a performance win of up to 0.1% in terms of average cycles and instructions executed on internal facebook search service.
Reviewed By: snehasish
Differential Revision: https://reviews.llvm.org/D131824
Nico Weber [Tue, 16 Aug 2022 14:59:29 +0000 (10:59 -0400)]
[gn build] build libclang_rt.ubsan_osx_dynamic.dylib on mac
For now, this only builds the dylib, so using `-fsanitize=undefined`
with `-static-libsan` or `fsanitize-minimal-runtime` still won't
work -- but the common case does work.
Differential Revision: https://reviews.llvm.org/D131969
Ellis Hoag [Wed, 17 Aug 2022 17:45:45 +0000 (10:45 -0700)]
[InstrProf] Add option to disable loop opt after PGO
Add the `-enable-post-pgo-loop-rotation` option to enable or disable the loop rotation transformation [1]. With some instrumentations, e.g., function entry coverage [2], loop rotation is not necessary and can lead to some surprise differences in codegen, even for functions where instrumentation is blocked with `noprofile` or `skipprofile`. The default value is `true` so the default behavior does not change.
[1] https://www.llvm.org/docs/LoopTerminology.html#loop-terminology-loop-rotate
[2] https://reviews.llvm.org/D116180
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D131817
Slava Gurevich [Mon, 15 Aug 2022 08:51:49 +0000 (01:51 -0700)]
[LLDB][NFC] Fix optons parsing and misc. reliability in CommandObjectThread
* Fix broken option parsing in SetOptionValue()
Differential Revision: https://reviews.llvm.org/D131983
Kent Ross [Wed, 17 Aug 2022 19:14:07 +0000 (12:14 -0700)]
[libcxx][spaceship][doc] Repair links and clean up spaceship progress doc
Previously the specification was in a table in paragraph 14 of [container.requirements.general] but it has since been given its own sub section header, 24.2.2.4 [container.opt.reqmts].
This happened in https://github.com/cplusplus/draft/commit/
93ff092d1cd2b335f372b9546365b3d495caf2d8
This update also includes misc. other cleanups of the spaceship projects sheet.
Reviewed By: Mordante, avogelsgesang, #libc
Differential Revision: https://reviews.llvm.org/D131928
Sanjay Patel [Wed, 17 Aug 2022 18:16:34 +0000 (14:16 -0400)]
[AArch64] add test for recursive libcall lowering; NFC
Issue #56403
Nirvedh Meshram [Wed, 17 Aug 2022 16:54:28 +0000 (16:54 +0000)]
[mlir][spirv] Modify intel joint matrix ops
Adding more supported storage classes in pointer type
Removing support for arithmetic ops as this is not available on the tensor hardware
Reviwed By: antiagainst
Differential Revision: https://reviews.llvm.org/D132039
Vladimir Plyashkun [Wed, 17 Aug 2022 18:25:48 +0000 (19:25 +0100)]
[clang-tidy] hicpp-signed-bitwise - Return location of the operand (and not of the operator beginning)
Currently, the "hicpp/signed-bitwise" check returns the beginning of the binary/unary operator as location, which sometimes confuses users in the IDE due to incorrect [[ https://youtrack.jetbrains.com/issue/CPP-12445/Clang-Tidy-highlighting-for-binary-operators-applied-to-wrong-operand | highlighting ]].
Yes, the offset from Ranges can be used for this particular check, but i suppose better solution is to return begin location of the problematic operand instead of operator.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D131678
Markus Böck [Wed, 17 Aug 2022 18:14:31 +0000 (20:14 +0200)]
[mlir] Fix stale comment about how to use `VariadicOfVariadic`
The kind of attribute required has changed in
58a47508f03546b4fce668fad751102b94feacfd but the comment was not updated to reflect it.
Vladislav Dzhidzhoev [Mon, 8 Aug 2022 18:04:21 +0000 (21:04 +0300)]
[AArch64][GlobalISel] Fallback to generic lowering of G_CTPOP
Use generic lowering of G_CTPOP for s32 and s64 scalars when
noimplicitfloat is specified.
Differential Revision: https://reviews.llvm.org/D131454
Louis Dionne [Mon, 8 Aug 2022 21:03:56 +0000 (17:03 -0400)]
[libc++] Diagnose when header search paths are set up incorrectly
An issue I often see in codebases compiled for unusual platforms is
that header search paths are specified manually and are subtly wrong.
For example, people will manually add `-isystem <some-toolchain>/usr/include`,
which ends up messing up the layering of header search paths required by
libc++ (because the C Standard Library now appears *before* libc++ in
the search paths). Without this patch, this will end up causing
compilation errors that are pretty inscrutable. This patch aims to
improve the user experience by diagnosing this issue explicitly.
In all cases I can think of, I would expect that a compilation error
occur if these header search paths are not layered properly. This
should only provide an explicit diagnostic instead of failing due
to seemingly unrelated compilation errors.
Differential Revision: https://reviews.llvm.org/D131441
Peiming Liu [Wed, 17 Aug 2022 17:18:18 +0000 (17:18 +0000)]
[mlir][sparse] fix compiler warning
Reviewed By: aartbik, bixia
Differential Revision: https://reviews.llvm.org/D132040
Dominic Chen [Wed, 17 Aug 2022 17:37:24 +0000 (10:37 -0700)]
Revert "[libcxx] Resolve warnings for Wshift-sign-overflow"
This reverts commit
774c39313e83e8087776246c186593ea0c751fd5.
Dominic Chen [Tue, 16 Aug 2022 22:05:21 +0000 (15:05 -0700)]
[libcxx] Resolve warnings for Wshift-sign-overflow
These warning were identified while debugging modules with Wsystem-headers.
Differential Revision: https://reviews.llvm.org/D131999
Nico Weber [Mon, 15 Aug 2022 15:16:03 +0000 (11:16 -0400)]
[llvm-objdump --macho] Rename --dyld_info to --dyld-info
llvm-objdump takes foo-bar style flags, while llvm-otool takes foo_bar style
flags. dyld_info was the only exception to that.
Add a -dyld_info flag to llvm-otool instead.
(Both in llvm-objdump and llvm-otool, the flag doesn't really do anything
yet.)
Differential Revision: https://reviews.llvm.org/D131897
Prabhu Karthikeyan Rajasekaran [Tue, 16 Aug 2022 00:46:05 +0000 (00:46 +0000)]
[llvm-readelf] Render messages similar to that of `GNU binutils readelf` when no sections and/or no headers.
When there are no section headers section information printed by llvm-readelf is not useful and unnecessarily verbose. When there are no program headers there's a similar verbose output shown when section mapping is requested. Simplifying the message shown in these cases to match the behavior of `GNU binuntils readelf`.
Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D130670
Craig Topper [Wed, 17 Aug 2022 16:40:49 +0000 (09:40 -0700)]
[RISCV] Fold (sub C, (xor (setcc), 1)) -> (add (setcc), C-1).
Extracted from D131729 where we handled C==0. It's now generalized
to more constants.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D132000
Craig Topper [Wed, 17 Aug 2022 16:40:29 +0000 (09:40 -0700)]
[RISCV] Refactor performSUBCombine to prepare for D132000.
This refactors the code into a separate function with early returns.
D132000 adds an additional operation to the if/else that selects
NewLHS, but can otherwise share the rest of the code.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D132002
Chelsea Cassanova [Wed, 10 Aug 2022 18:03:31 +0000 (14:03 -0400)]
[lldb][tests] Test queue-specific breakpoints
This commit adds tests to ensure that queue-specific breakpoints
work as expected, as this feature wasn't being tested before.
Differential Revision: https://reviews.llvm.org/D131605