Commit Graph

435274 Commits

Author SHA1 Message Date
Michał Górny ea953b9d9a [compiler-rt] [test] Handle missing ld.gold gracefully
Fix the is_binutils_lto_supported() function to handle missing
executables gracefully.  Currently, the function does not catch
exceptions from subprocess.Popen() and therefore causes lit to crash
if config.gold_executable does not specify a valid executable:

```
lit: /usr/lib/python3.11/site-packages/lit/TestingConfig.py:136: fatal: unable to parse config file '/tmp/portage/sys-libs/compiler-rt-
15.0.0/work/compiler-rt/test/lit.common.cfg.py', traceback: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/lit/TestingConfig.py", line 125, in load_from_path
    exec(compile(data, path, 'exec'), cfg_globals, None)
  File "/tmp/portage/sys-libs/compiler-rt-15.0.0/work/compiler-rt/test/lit.common.cfg.py", line 561, in <module>
    if is_binutils_lto_supported():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/portage/sys-libs/compiler-rt-15.0.0/work/compiler-rt/test/lit.common.cfg.py", line 543, in is_binutils_lto_supported
    ld_cmd = subprocess.Popen([exe, '--help'], stdout=subprocess.PIPE, env={'LANG': 'C'})
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1022, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1899, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'GOLD_EXECUTABLE-NOTFOUND'
```

Differential Revision: https://reviews.llvm.org/D133358
2022-09-07 07:14:31 +02:00
Vitaly Buka 4c18670776 [NFC][sancov] Rename ModuleSanitizerCoveragePass 2022-09-06 20:55:39 -07:00
Vitaly Buka 5e38b2a456 [NFC][msan] Rename ModuleMemorySanitizerPass 2022-09-06 20:30:35 -07:00
jacquesguan ac66d87c4b [mlir][Math] Add constant folder for RoundEvenOp.
This patch uses roundeven/roundevenf of libm to fold RoundEvenOp of constant.

Differential Revision: https://reviews.llvm.org/D133344
2022-09-07 11:13:00 +08:00
Sinan Lin 73593145cb [cmake] do not set execution permission to regular files.
some regular files(e.g. files have no shebang and no execute
bit in source dir) are wrongly assigned an execution permission,
such as scanview.css and ear.c from libscanbuild, which is
unnecessary and introduces warnings in some envs.

Reviewed By: MaskRay, phosek

Differential Revision: https://reviews.llvm.org/D133308
2022-09-07 11:04:12 +08:00
jacquesguan e3434a8627 [mlir][Math] Add constant folder for CosOp.
This patch adds constant folder for CosOp which only supports single and double precision floating-point.

Differential Revision: https://reviews.llvm.org/D131233
2022-09-07 10:54:08 +08:00
Chuanqi Xu 5f571eeb3f [NFC] [Frontend] Correct the use of 'auto' in SemaCoroutine and CGCoroutine
We should only use 'auto' in case we can know the type from the right
hand side of the expression. Also we need keep '*' around if the type is
a pointer actually. Few uses of 'auto' in SemaCoroutine.cpp and
CGCoroutine.cpp violates the rule. This commit tries to fix it.
2022-09-07 10:45:01 +08:00
Xiang1 Zhang 16743c9534 [CodeGen] Limit building time in CodeGenPrepare for huge function
Details:

Currently CodeGenPrepare is very time consuming in handling big functions.

Old Algorithm :
It iterate each BB in function, and go on handle very instructions in BB.
Due to some instruction optimizations may affect the BBs' dominate tree.
The old logic will re-iterate and try optimize for each BB.

Suppose we have a big function with 20000 BBs, If we handled the last BB
with fine tuning the dominate tree. We need totally re-iterate and try optimize
the 20000 BBs from the beginning.

The Complex is near N!

And we really encounter somes big tests (> 20000 BBs) that cost more than 30
mins in this pass. (Debug version compiler will cost 2 hours here)

What this patch do for huge function ?
It mainly changes the iteration way for optimization.

1 We do optimizeBlock for each BB (that is same with old way).
And, in the meaning time, If BB is changed/updated in the optimization, it will
be put into FreshBBs (try do optimizeBlock again).
The new created BB at previous iteration will also put into FreshBBs.

2 For the BBs which not updated at previous iteration, we directly skip it.
Strictly speaking, here may miss some opportunity, but the probability is very
small.

3 For Instructions in single BB, we do optimizeInst for each instruction.
If optimizeInst change the instruction dominator in this BB, rather than break
and go back to optimize the first BB (the old way), we directly iterate
instructions (to do optimizeInst) in this updated BB again (the new way).

What this patch do for small/normal (not huge) function ?
It is same with the Old Algorithm. (NFC)

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D129352
2022-09-07 10:05:40 +08:00
Jordan Rupprecht 2c38201b09 [test] Fix typo in setting the wrong Context test field
This manifests as an msan error because we check the value of `es`, but it's actually uninitialized because we mistakenly set `ss` twice.
2022-09-06 18:59:03 -07:00
Joseph Huber 7354a73945 [CUDA] Actually fix the test correctly this time 2022-09-06 20:31:27 -05:00
Joseph Huber a6bb7c22fc [CUDA] Fix test failing when using the new driver
Summary:
Previously the new driver crashed when using `-fsyntax-only` which
required a work-around in one of the test files. This was not properly
updated when it was fixed for the new driver. This patch fixes the test
and also adjusts a missing boolean check.
2022-09-06 20:14:20 -05:00
Joseph Huber 2753eafe5a [Clang] Fix the new driver crashing when using '-fsyntax-only'
The new driver currently crashses when attempting to use the
'-fsyntax-only' option. This is because the option causes all output to
be given the `TY_Nothing' type which should signal the end of the
pipeline. The new driver was not treating this correctly and attempting
to use empty input. This patch fixes the handling so we do not attempt
to continue when the input is nothing.

One concession is that we must now check when generating the arguments
for Clang if the input is of 'TY_Nothing'. This is because the new
driver will only create code if the device code is a dependency on the
host, creating the output without the dependency would require a
complete rewrite of the logic as we do not maintain any state between
calls to 'BuildOffloadingActions' so I believe this is the most
straightforward method.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D133161
2022-09-06 19:49:47 -05:00
natashaknk e47ca72e30 [mlir][tosa] Support non-batch dynamic dims for tosa.rescale to linalg
Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D133383
2022-09-06 17:30:02 -07:00
Richard Smith a002063de3 Enforce module decl-use restrictions and private header restrictions in textual headers
Per the documentation, these restrictions were intended to apply to textual headers but previously this didn't work because we decided there was no requesting module when the `#include` was in a textual header.

A `-cc1` flag is provided to restore the old behavior for transitionary purposes.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D132779
2022-09-06 17:12:57 -07:00
Florian Mayer 4f5147a7cf [HWASan] Show memory rather than tag addresses in tag dump
Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D133380
2022-09-06 16:54:34 -07:00
Fangrui Song c89b78a22b [test] Remove PowerPC/aix-xcoff-exported-nondefault.ll
This is not asserted by IR verifier.
2022-09-06 16:48:16 -07:00
Craig Topper d3b9970342 [RISCV] Use llvm::none_of to replace a loop. NFC 2022-09-06 16:24:23 -07:00
Ruobing Han fb45f3c948 [SimpleLoopUnswitch] Skip non-trivial unswitching of cold functions
In the current main branch, all cold loops will not be applied non-trivial unswitch. As reported in D129599, skipping these cold loops will incur regression in SPEC benchmark.
Thus, instead of skipping cold loops, now only skipping loops in cold functions.

Reviewed By: alexgatea, aeubanks

Differential Revision: https://reviews.llvm.org/D133275
2022-09-06 19:13:31 -04:00
River Riddle bb6d12b5ce [mlir] Flip default value of emitAccessorPrefix to kEmitAccessorPrefix_Prefixed
Most dialects have already flipped to prefixed, and the intention to switch
has been telegraphed for a while.

Differential Revision: https://reviews.llvm.org/D133179
2022-09-06 15:56:57 -07:00
Vitaly Buka 2eda7c5b38 [test][hwasan] Update test for D132622 2022-09-06 15:54:04 -07:00
Vitaly Buka 181d408186 [pipelines] OptimizerEarlyEPCallbacks for ThinLTO prelink
Similar to OptimizerLastEPCallbacks workaround
added D96320.

Probably NFC as-is, I don't see anything hooked with this callbacks yet,
but I we are looking to move sanitizers.

Reviewed By: aeubanks, MaskRay

Differential Revision: https://reviews.llvm.org/D133333
2022-09-06 15:54:04 -07:00
Anastasia Stulova e28a5ceca9 [mlir][tosa] Fix dynamic shape inference in conv2d
The comment in the code correctly states the equation for the shape inference as follows:

```
H = ((IH+pad_top+pad_bottom-(dilation_y*(KH-1)+1))/stride_y)+1
```

However the final operation is generated as `-` instead of `+`. I believe `+`
is indeed correct. For example if we have an image with dimension 6 and kernel
of dimension 3 (assuming padding is 0 and stride and dilation are both 1) we
are expecting 4 elements in the output (computed for image elements `(0, 1, 2)
x kernel`, `(1, 2, 3) x kernel`, `(2, 3, 4) x kernel` and `(3, 4, 5) x kernel`.
However currently only 2 elements are produced in the output.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D133208
2022-09-06 15:42:04 -07:00
Peiming Liu 67dc6674c1 [mlir][tensor] Fix a typo in the example code for UnrankedTensorType
The syntax for unrank tensor type is defined as  tensor-type ::= `tensor` `<` `*` `x` type `>`, the example code missed the `x` in between.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133381
2022-09-06 22:31:47 +00:00
Fangrui Song 97d00b72a2 [Verifier] Allow dllexport protected after D133267
I have noticed that this combo makes sense (D133266) but rejected it for
simplicity. It turns out to be used by PlayStation, so let's allow it.
2022-09-06 15:28:29 -07:00
Vitaly Buka 93600eb50c [NFC][asan] Rename ModuleAddressSanitizerPass 2022-09-06 15:02:11 -07:00
Vitaly Buka e7bac3b9fa [msan] Convert Msan to ModulePass
MemorySanitizerPass function pass violatied requirement 4 of function
pass to do not insert globals. Msan nees to insert globals for origin
tracking, and paramereters tracking.

https://llvm.org/docs/WritingAnLLVMPass.html#the-functionpass-class

Reviewed By: kstoimenov, fmayer

Differential Revision: https://reviews.llvm.org/D133336
2022-09-06 15:01:04 -07:00
River Riddle 82b6549654 [mlir:vscode] Add support for loading big bytecode files
VSCode doesn't let our extension manage files >50mb. This commit
adds a proper diagnostic in this case, and also gives the user an option
to open as a temporary .mlir file instead.

Differential Revision: https://reviews.llvm.org/D133242
2022-09-06 14:49:16 -07:00
Arthur Eubanks 7f57c97d30 [ThinLTOBitcodeWriter] Mark pass as required
Or else with -opt-bisect-limit we don't write ThinLTO bitcode.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D133378
2022-09-06 14:47:34 -07:00
Craig Topper 7440e2274f [RISCV] Add '32bit' feature to rv32 only builtins.
The backend now has a 32bit feature as part of the recent mtune
patch. We can now use that make our rv32-only builtin error checking
work the same way as rv64-only errors.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D132192
2022-09-06 14:46:35 -07:00
River Riddle f3502afe85 [mlir] Allow passing AsmState when printing Attributes and Types
This allows for extracting assembly information when printing an attribute
or type, such as the dialect resources referenced. This functionality is used in
a followup that adds resource support to the bytecode. This change also results
in a nice cleanup of AsmPrinter now that we don't need to awkwardly workaround
optional AsmStates.

Differential Revision: https://reviews.llvm.org/D132728
2022-09-06 14:45:12 -07:00
Krzysztof Drewniak 839b436c93 [mlir] Improve BitEnumAttr, update documentation
- Add new operators to BitEnumAttr, mainly not (which only inverts
bits that can be valid bits for the attribute) and xor
- Add new bit enum utility functions: bitEnumClear(bits, bit) and
bitEnumSet(bits, bit, value=true) as they've come up in code I've been
writing that makes use of such enums
- Add rudimentary tests for the enum generator
- Update the OpDefinition documentation to make it contain a correct
example and to have it account for the changes mentioned above.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D133374
2022-09-06 21:36:34 +00:00
Simon Pilgrim 648e182d92 [CostModel][X86] getIntrinsicInstrCost - convert to CostKindTblEntry
Begin the refactoring to use CostKindTblEntry and return real latency/codesize/sizelatency costs instead of reusing the throughput numbers

This should allow us to merge getTypeBasedIntrinsicInstrCost into getIntrinsicInstrCost and remove all remaining references
2022-09-06 22:05:32 +01:00
Peiming Liu d50d678854 [mlir][sparse] Add lowering rules for sparse_tensor.storage Op
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133368
2022-09-06 21:04:16 +00:00
bzcheeseman 716b9f7a1a [LLVM][Support/ADT] Add assert for isPresent to dyn_cast.
This change adds an assert to dyn_cast that the value passed-in is present. In the past, this relied on the isa_impl assertion (which still works in many cases) but which we can tighten up for a better QoI.

The PointerUnion change is because it seems like (based on the call sites) the semantics of the member dyn_cast are actually dyn_cast_if_present.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D133221
2022-09-06 13:58:56 -07:00
Florian Mayer 9006b082a5 [HWASan] rename left/right to before/after.
left/right is a weird way to refer to address ordering.

Reviewed By: eugenis, vitalybuka

Differential Revision: https://reviews.llvm.org/D132622
2022-09-06 13:52:28 -07:00
Aaron Ballman d3d334a625 Fix the Clang sphinx build bot; NFC
This should address the failure introduced in:
https://lab.llvm.org/buildbot/#/builders/92/builds/32377
2022-09-06 16:50:22 -04:00
raghavmedicherla 57f01fee1e [AMDGPU/Metadata] Rename HSAMD::MetadataStreamer classes
Renamed all HSAMD::MetadataStreamer classes to improve readability of the code.

Differential Revision: https://reviews.llvm.org/D133156
2022-09-06 16:46:37 -04:00
raghavmedicherla 142f51fc2f Support: Add mapped_file_region::sync(), equivalent to msync
Add mapped_file_region::sync(), equivalent to POSIX msync,
synchronizing written content to disk without unmapping the region.
Asserts if the mode is not mapped_file_region::readwrite.

Note that I don't have access to a Windows machine, so I can't
easily run those unit tests.

Change by dexonsmith

Differential Revision: https://reviews.llvm.org/D95494
2022-09-06 16:46:37 -04:00
Vitaly Buka beb413acce [test][libcxx] Mark ubsan test as UNSUPPORTED
It inconsistently fails on bots.
2022-09-06 13:44:28 -07:00
Florian Mayer a51d19636c [ASan] Fix libfuzzer test 2022-09-06 13:37:35 -07:00
Philip Reames 10a74262ca [docs][RISCV] Document status of Zicpo(m,p,z) extensions
Unless I missed something when checking, we only support these in assembly. Given that, documenting them is a good opportunity to define support levels which will be useful for other extensions as well.

Differential Revision: https://reviews.llvm.org/D133372
2022-09-06 13:36:35 -07:00
Alexander Shaposhnikov 6a2442e9be [AArch64] Increase AddedComplexity of BIC
This diff adjusts AddedComplexity of BIC to bump its position
in the list of patterns to make LLVM pick it instead of MVN + AND.
MVN + AND requires 2 cycles, so does e.g. MOV + BIC, but the latter
outperforms the former if the instructions producing the operands of
BIC can be issued in parallel.

One may consider the following example:

ldur x15, [x0, #2] # 4 cycles
mvn x10, x15 # 1 cycle (depends on ldur)
and x9, x10, #0x8080808080808080

vs.

ldur x15, [x0, #2] # 4 cycles
mov x9, #0x8080808080808080 # 1 cycle (can be executed in parallel with ldur)
bic x9, x9, x15. # 1 cycle

Test plan: ninja check-all

Differential revision: https://reviews.llvm.org/D133345
2022-09-06 20:31:24 +00:00
Joseph Huber 31f434ee3b [Libomptarget][NFC] Clean up CUDA plugin and address warnings 2022-09-06 15:28:57 -05:00
Simon Pilgrim d654934b07 [CostModel][X86] Fix check prefixes on cttz cost kinds tests
Add missing SSE2 + BMI/NOBMI coverage
2022-09-06 21:27:51 +01:00
Florian Mayer be366041fa [ASan] rename left/right to before/after.
left/right is a weird way to refer to address ordering.

Reviewed By: eugenis, MaskRay

Differential Revision: https://reviews.llvm.org/D132611
2022-09-06 13:25:15 -07:00
Jim Ingham 9690308f78 Fix another place were we suggest lldb.target in a Frame Recognizer. 2022-09-06 13:24:21 -07:00
Jim Ingham edea4a349d You can't use lldb.target in a frame recognizer. 2022-09-06 13:20:48 -07:00
Alexander Shaposhnikov 44503482e0 [clang-tidy] Skip union-like classes in use-equals-default
Skip unions/union-like classes since in this case constructors
with empty bodies behave differently in comparison with regular
structs/classes.

Test plan: ninja check-clang-tools

Differential revision: https://reviews.llvm.org/D132713
2022-09-06 20:19:47 +00:00
Vitaly Buka b4257d3bf5 [tsan] Replace mem intrinsics with calls to interceptors
After https://reviews.llvm.org/rG463aa814182a23 tsan replaces llvm
intrinsics with calls to glibc functions. However this approach is
fragile, as slight changes in pipeline can return llvm intrinsics back.
In particular InstCombine can do that.

Msan/Asan already declare own version of these memory
functions for the similar purpose.

KCSAN, or anything that uses something else than compiler-rt, needs to
implement this callbacks.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D133268
2022-09-06 13:09:31 -07:00
Vitaly Buka 4a0b18c2cd [tsan][go] Fix buildgo.sh when GOAMD64 undefined 2022-09-06 13:02:11 -07:00