Commit Graph

432132 Commits

Author SHA1 Message Date
Lang Hames b5f76d83ff [ORC] Ensure that llvm_orc_registerJITLoaderGDBAllocAction is linked into tools.
Add a reference to llvm_orc_registerJITLoaderGDBAllocAction from the
linkComponents function in the lli, llvm-jitlink, and llvm-jitlink-executor
tools. This ensures that llvm_orc_registerJITLoaderGDBAllocAction is not
dead-stripped in optimized builds, which may cause failures in these tools.

The llvm_orc_registerJITLoaderGDBAllocAction function was originally added with
MachO debugging support in 69be352a19, but that patch failed to update the
linkComponents functions.

http://llvm.org/PR56817
2022-08-03 17:51:45 -07:00
Lang Hames 4229d2788b [JITLink] Add tests for FDEs with bad CIE and PC-begin pointers. 2022-08-03 17:51:45 -07:00
Arthur Eubanks 203296d642 [BoundsChecking] Fix merging of sizes
BoundsChecking uses ObjectSizeOffsetEvaluator to keep track of the
underlying size/offset of pointers in allocations.  However,
ObjectSizeOffsetVisitor (something ObjectSizeOffsetEvaluator
uses to check for constant sizes/offsets)
doesn't quite treat sizes and offsets the same way as
BoundsChecking.  BoundsChecking wants to know the size of the
underlying allocation and the current pointer's offset within
it, but ObjectSizeOffsetVisitor only cares about the size
from the pointer to the end of the underlying allocation.

This only comes up when merging two size/offset pairs. Add a new mode to
ObjectSizeOffsetVisitor which cares about the underlying size/offset
rather than the size from the current pointer to the end of the
allocation.

Fixes a false positive with -fsanitize=bounds.

Reviewed By: vitalybuka, asbirlea

Differential Revision: https://reviews.llvm.org/D131001
2022-08-03 17:21:19 -07:00
Vitaly Buka a2aa6809a8 [NFC][Inliner] Add cl::opt<int> to tune InstrCost
The plan is tune this for sanitizers.

Differential Revision: https://reviews.llvm.org/D131123
2022-08-03 17:14:10 -07:00
Congzhe Cao 8dc4b2edfa [LoopInterchange][PR56275] Fix legality with negative dependence vectors
This is the 2nd patch of the two-patch series (D130188, D130189) that
fix PR56275 (https://github.com/llvm/llvm-project/issues/56275) which
is a missed opportunity for loop interchange.

As follow-up on the dependence analysis (DA) patch D130188, this patch
normalizes DA results in loop interchange, such that negative dependence
vectors queried by loop interchange are reversed to be non-negative.

Now all tests in PR56275 can get interchanged. Those tests are added
in lit test as `pr56275.ll`.

Reviewed By: kawashima-fj, bmahjour, Meinersbur, #loopoptwg

Differential Revision: https://reviews.llvm.org/D130189
2022-08-03 19:59:01 -04:00
Congzhe Cao 76be554931 [DependenceAnalysis][PR56275] Normalize negative dependence analysis results
This patch is the first of the two-patch series (D130188, D130179) that
resolve PR56275 (https://github.com/llvm/llvm-project/issues/56275)
which is a missed opportunity, where a perfrectly valid case for loop
interchange failed interchange legality.

If the distance/direction vector produced by dependence analysis (DA) is
negative, it needs to be normalized (reversed). This patch provides helper
functions `isDirectionNegative()` and `normalize()` in DA that does the
normalization, and clients can query DA to do normalization if needed.

A pass option `<normalized-results>` is added to DependenceAnalysisPrinterPass,
and we leverage it to update DA test cases to make sure of test coverage. The
test cases added in `Banerjee.ll` shows that negative vectors are normalized
with `print<da><normalized-results>`.

Reviewed By: bmahjour, Meinersbur, #loopoptwg

Differential Revision: https://reviews.llvm.org/D130188
2022-08-03 19:59:00 -04:00
Philip Reames a243af52bb [CostModel][RISCV] Add test coverage of floating point rounding intrinsics
These costs are fairly bogus, but at least we have baseline coverage now.
2022-08-03 16:51:43 -07:00
Bill Wendling 239c831de4 Add switch to use "source_filename" instead of a hash ID for globally promoted local
During LTO a local promoted to a global gets a unique suffix based on
a hash of the module IR. This means that changes in the local's module
can affect the contents in another module that imported it (because the name
of the imported promoted local is changed, but that doesn't reflect a
real change in the importing module). So any tool that's
validating changes to the importing module will see a superficial change.

Instead of using the module hash, we can use the "source_filename" if it
exists to generate a unique identifier that doesn't change due to LTO
shenanigans.

Differential Revision: https://reviews.llvm.org/D128863
2022-08-03 16:41:56 -07:00
LLVM GN Syncbot ca8de2d242 [gn build] Port 0cb9746a7d 2022-08-03 23:20:59 +00:00
Mircea Trofin 0cb9746a7d [nfc][mlgo] Separate logger and training-mode model evaluator
This just shuffles implementations and declarations around. Now the
logger and the TF C API-based model evaluator are separate.

Differential Revision: https://reviews.llvm.org/D131116
2022-08-03 16:20:28 -07:00
LLVM GN Syncbot 670122b92b [gn build] Port 36c746ca2d 2022-08-03 23:08:51 +00:00
Slava Gurevich 5a906b70c1 [LLDB][NFC] Fix potential div by 0 "count" can be zero potentially causing div by 0
Differential Revision: https://reviews.llvm.org/D130939
2022-08-03 16:08:18 -07:00
Konstantin Varlamov 36c746ca2d [libc++][ranges] Implement `ranges::rotate`.
Also fix `ranges::stable_sort` and `ranges::inplace_merge` to support
proxy iterators now that their internal implementations can correctly
dispatch `rotate`.

Differential Revision: https://reviews.llvm.org/D130758
2022-08-03 16:04:24 -07:00
Blue Gaston 42c15ca630 [TSAN][Darwin] x86_64 specific tests requiring weak symbols
Additional tests requiring weak symbol attribute work around for macOS 12.0

Differential Revision: https://reviews.llvm.org/D131119
2022-08-03 15:51:23 -07:00
Jonas Devlieghere 71ebcd3348
[lldb] Make LLDB resilient against failing dyld introspection SPIs
Make LLDB resilient against failing dyld introspection SPIs:

 - dyld_process_create_for_current_task
 - dyld_process_snapshot_create_for_process
 - dyld_process_snapshot_get_shared_cache

These can all fail and return a nullptr. Instead of having an assert,
which doesn't really make sense, as we have no control over whether
these calls succeed or not, bail out gracefully and use the fallback
logic.

rdar://98070414

Differential revision: https://reviews.llvm.org/D131110
2022-08-03 15:47:58 -07:00
jeff e0b16aaaf9 [AMDGPU] Precommit test case for D130729
Change-Id: I23396655880b5732ad991d47e51900408f5bc5ee
2022-08-03 15:22:16 -07:00
Craig Topper 53d560b22f [RISCV] Prevent infinite loop after D129980.
D129980 converts (seteq (i64 (and X, 0xffffffff)), C1) into
(seteq (i64 (sext_inreg X, i32)), C1). If bit 31 of X is 0, it
will be turned back into an 'and' by SimplifyDemandedBits which
can cause an infinite loop.

To prevent this, check if bit 31 is 0 with computeKnownBits before
doing the transformation.

Fixes PR56905.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D131113
2022-08-03 15:19:07 -07:00
Vitaly Buka 26dd42705c [NFC][Inliner] Simplify clamping in addCost 2022-08-03 14:54:37 -07:00
Craig Topper 84e9194828 Revert "[X86][MC] Always emit `rep` prefix for `bsf`"
This reverts commit c2066d19cd.

It's causing failures on the build bots.
2022-08-03 14:51:34 -07:00
Jonas Devlieghere 9ffcc85fbe
Revert "Revert "[lldb][modules] Disable Clang Modules in source/Host directory on macOS""
This reverts commit c7bd61d4a7 because it
breaks the underlying issue is apparently not yet resolved. This only
affects the modules build.
2022-08-03 14:39:45 -07:00
Craig Topper 11322203b7 [X86] Add a test for missed opportunity combine AND32rm+TEST32rr.
If the chain output of the AND32rm is used, the post isel peephole
won't fold it. We should be able to fold it by replacing the chain
use with the chain from a TEST32rm.
2022-08-03 14:33:26 -07:00
Jonas Devlieghere 2b61b770df
[lldb] Make TestModuleLoadedNotifys work with dyld from the shared cache
Make TestModuleLoadedNotifys work with a dyld from the expanded shared
cache in the DeviceSupport directory. In that case the module path is:

  ~/Library/Developer/Xcode/iOS DeviceSupport/<...>/Symbols/usr/lib/dyld

instead of just:

  /usr/lib/dyld

This makes the test pass when running against an embedded Darwin device.
2022-08-03 14:24:42 -07:00
Jonas Devlieghere 880b2128ef
[lldb] Mark TestRosetta as skipIfDarwinEmbedded
This test only makes sense on the host.
2022-08-03 14:24:37 -07:00
Chris Bieneman 383e754072 NFC. Require DirectX backend for these tests
Should have added this when I added the test directory. This just
requires the DirectX target for running these tests.
2022-08-03 15:55:03 -05:00
Chris Bieneman ce0bb316eb [DX] [NFC] Move hasSection check up
Juming out earlier if the global doesn't have a section is just a
cleaner early out.
2022-08-03 15:54:53 -05:00
Vitaly Buka e056e74dda [NFC][inline] Add const to an argument 2022-08-03 13:20:47 -07:00
Craig Topper ff91b2d9df [X86] Promote i16 CTTZ/CTTZ_ZERO_UNDEF always.
If we're going to emit a rep prefix before bsf as proposed in
D130956, it makes sense to promote i16 operations to i32 to avoid
the false depedency of tzcntw.

Reviewed By: skan, pengfei

Differential Revision: https://reviews.llvm.org/D130995
2022-08-03 13:12:20 -07:00
Rafael Auler 19eb908e61 [BOLT] Remove always true if statement
Got a warning from GCC when building this.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D131092
2022-08-03 13:11:33 -07:00
Adrian Prantl 11e5275cc2 Document why test is disabled on macOS Ventura
Starting with macOS 13 CoreFoundation pulls in Foundation, so we
always get the Foundation object description.

rdar://96224141

Differential Revision: https://reviews.llvm.org/D131025
2022-08-03 13:05:21 -07:00
Adrian Prantl 905f2d1ecb Fix LDV InstrRefBasedImpl to not crash when encountering unreachable MBBs.
The testcase was delta-reduced from an LTO build with sanitizer
coverage and the MIR tail duplication pass caused a machine basic
block to become unreachable in MIR. This caused the MBB to be invisible
to the reverse post-order traversal used to initialize the MBB <->
RPONumber lookup tables.

rdar://97226240

Differential Revision: https://reviews.llvm.org/D130999
2022-08-03 13:05:05 -07:00
Louis Dionne c5ccb78ade [clang][Darwin] Always set the default C++ Standard Library to libc++
Newer SDKs don't even provide libstdc++ headers, so it's effectively
never valid to build for libstdc++ unless the user explicitly asks
for it (in which case they will need to provide include paths and more).
2022-08-03 15:40:27 -04:00
Joseph Huber b3335e8ed7 [Libomptarget][NFC] Clang format the AMDGPU plugin
Summary:
A previous patch did not format the plugin again after making changes.
Ensure that libomptarget stays formatted.
2022-08-03 15:18:16 -04:00
Siva Chandra f0bb276794 [libc] Disable the loader init_fini_array_test for non-x86_64 targets.
Loader for aarch64 will be extended in a future pass and this test will
be enabled back again.
2022-08-03 12:06:13 -07:00
Corentin Jabot a274219600 Revert "[Clang][C++20] Support capturing structured bindings in lambdas"
This reverts commit 44f2baa380.

Breaks self builds and seems to have conformance issues.
2022-08-03 21:00:29 +02:00
Augusto Noronha 1f64f8bcab [lldb] Fix 'FileCheck' spelling on symtab regex tests 2022-08-03 11:57:33 -07:00
Jonas Devlieghere 0f821339da
[lldb] Add assertStopReason helper function
Add a function to make it easier to debug a test failure caused by an
unexpected stop reason. This is similar to the assertState helper that
was added in ce825e4674.

Before:

  self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: 5 != 10

After:

  self.assertStopReason(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: signal (5) != instrumentation (10)

Differential revision: https://reviews.llvm.org/D131083
2022-08-03 11:44:13 -07:00
Walter Erquinigo 3716107934 [NFC][intel pt] Improve troubleshooting message 2022-08-03 11:34:03 -07:00
Alex Bradbury 9e966dd298 [RISCV][test] Add test for ability to tailcall libcalls
Although there's good coverage of the libcalls within llvm/test/CodeGen,
it's useful to have tests for all ABI and hard/soft-float combinations
in order to properly test the logic that enables libcall tail calls
(which will be implemented in a follow-up patch).
2022-08-03 19:27:59 +01:00
Vincent Lee c77db81616 [CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
This is motivated by https://reviews.llvm.org/D115852#3226050 where passing
`LLVM_USE_LINKER` in PASSTHROUGH_PREFIXES breaks cross-compilation
(e.g. targeting Windows on a Linux host). As suggested on that diff, implement
an override for it by allowing users to pass `RUNTIMES_${target}_LLVM_USE_LINKER`
to specify the linker for runtimes. Defaults to host linker if not specified.

Reviewed By: phosek, smeenai

Differential Revision: https://reviews.llvm.org/D131051
2022-08-03 11:24:09 -07:00
Felipe de Azevedo Piovezan a5a8a05c78 [SelectionDAG] Handle IntToPtr constants in dbg.value
The function `handleDebugValue` has custom logic to handle certain kinds
constants, namely integers, floats and null pointers. However, it does
not handle constant pointers created from IntToPtr ConstantExpressions.
This patch addresses the issue by replacing the Constant with its
integer operand.

A similar bug was addressed for GlobalISel in D130642.

Reviewed By: aprantl, #debug-info

Differential Revision: https://reviews.llvm.org/D130908
2022-08-03 14:10:05 -04:00
Aaron Ballman c9edf843fc Error instead of assert when making a _BitInt vector
We already correctly rejected:
typedef __attribute__((vector_size(16))) _BitInt(4) Ty;

but we would assert with:
typedef __attribute__((ext_vector_type(4))) _BitInt(4) Ty;

Now we issue the same error in both cases.
2022-08-03 14:05:09 -04:00
Fangrui Song 71e8f79601 [ubsan] Make TypeCheckKinds const. NFC
Move it from .data to .data.rel.ro
2022-08-03 11:02:22 -07:00
Corentin Jabot 44f2baa380 [Clang][C++20] Support capturing structured bindings in lambdas
This completes the implementation of P1091R3 and P1381R1.

This patch allow the capture of structured bindings
both for C++20+ and C++17, with extension/compat warning.

In addition, capturing an anonymous union member,
a bitfield, or a structured binding thereof now has a
better diagnostic.

We only support structured bindings - as opposed to other kinds
of structured statements/blocks. We still emit an error for those.

In addition, support for structured bindings capture is entirely disabled in
OpenMP mode as this needs more investigation - a specific diagnostic indicate the feature is not yet supported there.

Note that the rest of P1091R3 (static/thread_local structured bindings) was already implemented.

at the request of @shafik, i can confirm the correct behavior of lldb wit this change.

Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/52720

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D122768
2022-08-03 20:00:01 +02:00
Augusto Noronha 3aef968ec3 [lldb] Allow SymbolTable regex search functions to match mangled name
It may be useful to search symbol table entries by mangled instead
of demangled names. Add this optional functionality in the SymbolTable
functions.

Differential Revision: https://reviews.llvm.org/D130803
2022-08-03 10:55:32 -07:00
Siva Chandra Reddy f23076f6c5 [libc] Add init and fini array iteration to the loader.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D130966
2022-08-03 17:53:23 +00:00
Jonas Devlieghere 6a48dc092b
[lldb] Add missing newlines after LLDB_INSTRUMENT_VA
Add a newline after LLDB_INSTRUMENT_VA to match the output of lldb-instr
and keep everything consistent.
2022-08-03 10:51:16 -07:00
isuckatcs 10a7ee0bac [analyzer] Fix for the crash in #56873
In ExprEngine::bindReturnValue() we cast an SVal to DefinedOrUnknownSVal,
however this SVal can also be Undefined, which leads to an assertion failure.

Fixes: #56873

Differential Revision: https://reviews.llvm.org/D130974
2022-08-03 19:25:02 +02:00
Michał Górny 3426fc7318 Revert "[lldb] [gdb-remote] Send interrupt packets from async thread"
This reverts commit 446b61cff4.  Of course
it does not work on Windows.
2022-08-03 19:09:35 +02:00
Amy Huang f3bd773abd Replace pdb file used in llvm-symbolizer test with a smaller file.
Reduce the size of the test-columns.pdb file from 6MB to 72KB by not
including standard libraries when building. Also update the instructions
for building the exe/pdb files.

context https://reviews.llvm.org/D81950#3692893

Differential Revision: https://reviews.llvm.org/D131035
2022-08-03 09:58:26 -07:00
Ben Langmuir 6a79e2ff19 [clang] Add FileEntryRef::getNameAsRequested()
As progress towards having FileManager::getFileRef() return the path
as-requested by default, return a FileEntryRef that can use
getNameAsRequested() to retrieve this path, with the ultimate goal that
this should be the behaviour of getName() and clients should explicitly
request the "external" name if they need to (see comment in
FileManager::getFileRef). For now, getName() continues to return the
external path by looking through the redirects.

For now, the new function is only used in unit tests.

Differential Revision: https://reviews.llvm.org/D131004
2022-08-03 09:41:08 -07:00