Commit Graph

419554 Commits

Author SHA1 Message Date
Louis Dionne
f29002a4b7 [libunwind] Add a _LIBUNWIND_VERSION macro
This allows us to detect whether we're being compiled with LLVM's libunwind
more easily, without CMake having to set explicit variables.

As discussed in https://llvm.org/D119538.

Differential Revision: https://reviews.llvm.org/D121015
2022-03-30 11:23:36 -04:00
Sanjay Patel
436b875e49 [SDAG] avoid libcalls to fmin/fmax for soft-float targets
This is an extension of D70965 to avoid creating a mathlib
call where it did not exist in the original source. Also see
D70852 for discussion about an alternative proposal that was
abandoned.

In the motivating bug report:
https://github.com/llvm/llvm-project/issues/54554
...we also have a more general issue about handling "no-builtin" options.

Differential Revision: https://reviews.llvm.org/D122610
2022-03-30 11:22:03 -04:00
Pavel Labath
21c5bb0a63 Recommit [lldb/test] Make category-skipping logic "platform"-independent
This recommits dddf4ce03, which was reverted because of a couple of test
failures on macos. The reason behind the failures was that the patch
inadvertenly changed the value returned by the host platform from
"macosx" to "darwin". The new version fixes that.

Original commit message was:

The decision which categories are relevant for a particular test run
happen very early in the test setup process. They use the SBPlatform
object to determine which categories should be skipped. The platform
object created for this purpose transcends individual test runs.

This setup is not compatible with the direction discussed in
<https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594>
-- when platform objects are tied to a specific (SB)Debugger, they need
to be created alongside it, which currently happens in the test setUp
method.

This patch is the first step in that direction -- it rewrites the
category skipping logic to avoid depending on a global SBPlatform
object. Fortunately, the skipping logic is fairly simple (and I believe
it outght to stay that way) and mainly consists of comparing the
platform name against some hardcoded lists. This patch bases this
comparison on the platform name instead of the os part of the triple (as
reported by the platform).

Differential Revision: https://reviews.llvm.org/D121605
2022-03-30 17:16:37 +02:00
serge-sans-paille
c531171d99 Fix invalid overflow check in flang
Statically checking for overflow with

    if constexpr (sizeof(std::size_t) <= sizeof(std::int64_t)) {
         return static_cast<std::int64_t>(length);
    }

Doesn't work if `sizeof(std::size_t) == sizeof(std::int64_t)` because std::size_t
is unsigned.

if `length == std::numeric_limits<size_t>` casting it to `int64_t` is going to overflow.

This code would be much simpler if returning a `uint64_t` instead of a signed
value...

Differential Revision: https://reviews.llvm.org/D122705
2022-03-30 16:47:33 +02:00
Jun Zhang
5b38292d5d
[NFC] Use range based loop.
Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D122657
2022-03-30 22:44:34 +08:00
Fraser Cormack
da6131f20a [VP] Add vp.fcmp comparison intrinsic and docs
This patch adds the first support for vector-predicated comparison
intrinsics, starting with vp.fcmp. It uses metadata to encode its
condition code, like the llvm.experimental.constrained.fcmp intrinsic.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D121292
2022-03-30 14:39:18 +01:00
Sanjay Patel
e18cc5277f [SDAG] try to canonicalize logical shift after bswap
When shifting by a byte-multiple:
bswap (shl X, C) --> lshr (bswap X), C
bswap (lshr X, C) --> shl (bswap X), C

This is the backend version of D122010 and an alternative
suggested in D120648.
There's an extra check to make sure the shift amount is
valid that was not in the rough draft.

I'm not sure if there is a larger motivating case for RISCV (bug report?),
but the ARM diffs show a benefit from having a late version of the
transform (because we do not combine the loads in IR).

Differential Revision: https://reviews.llvm.org/D122655
2022-03-30 09:29:32 -04:00
Sanjay Patel
849d577e56 [x86] add tests for fcmp with 0.0 operand; NFC 2022-03-30 08:37:15 -04:00
Sanjay Patel
5b4bbaa8d8 [SystemZ] generate full checks for tests; NFC
These may change if we transform the fcmp (setcc) to avoid a constant operand.
2022-03-30 08:37:15 -04:00
Simon Pilgrim
14a89d00c7 [X86] Extend xor-lea test coverage
Add XOR(ADD/SUB(X,Y),MIN_SIGNED_VALUE) tests and adjust some XOR(SHL(X,C),MIN_SIGNED_VALUE) shifts to better match LEA scales
2022-03-30 13:34:32 +01:00
Fraser Cormack
43a91a8474 [SelectionDAG] Don't create illegally-typed nodes while constant folding
This patch fixes a (seemingly very rare) crash during vector constant
folding introduced in D113300.

Normally, during legalization, if we create an illegally-typed node during
a failed attempt at constant folding it's cleaned up before being
visited, due to it having no uses.

If, however, an illegally-typed node is created during one round of
legalization and isn't cleaned up, it's possible for a second round of
legalization to create new illegally-typed nodes which add extra uses to
the old illegal nodes. This means that we can end up visiting the old
nodes before they're known to be dead, at which point we crash.

I'm not happy about this fix. Creating illegal types at all seems like a
bad idea, but we all-too-often rely on illegal constants being
successfully folded and being fixed up afterwards. However, we can't
rely on constant folding actually happening, and we don't have a
foolproof way of peering into the future.

Perhaps the correct fix is to revisit the node-iteration order during
legalization, ensuring we visit all uses of nodes before the nodes
themselves. Or alternatively we could try and clean up dead nodes
immediately after failing constant folding.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D122382
2022-03-30 13:17:55 +01:00
Florian Hahn
8a4077fac0
[LV] Pass LoopHeaderBB directly to updateDominatorTree. (NFC)
At the call site, we already know what the vector header block is. Pass
it directly.
2022-03-30 13:11:20 +01:00
Nikita Popov
76174459ac [RuntimeDebugBuilder] Remove pointer element type accesses 2022-03-30 14:02:41 +02:00
Simon Pilgrim
e000dbc39f [X86] Add test coverage based off Issue #51609 2022-03-30 12:57:22 +01:00
wangpc
cebbfd3d25 [RISCV] Add index check for vset/vget
Index of vset/vget must be a constant integer and be
located in right range.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D122629
2022-03-30 19:29:13 +08:00
Aaron Ballman
cf4a67bcbb Don't diagnostic atomic object access as UB in an unevaluated context
We started diagnosing this situation with a more clear diagnostic
message, but it was pointed out that unevaluated contexts don't really
have the undefined behavior property as there is no runtime access
involved.

This augments the changes in https://reviews.llvm.org/D122656 to not
diagnose in an unevaluated context.
2022-03-30 07:12:49 -04:00
Simon Pilgrim
4a33b9ece0 [MC][X86] Ensure all opcode tests are sorted by instruction name
Noticed while reviewing D122449
2022-03-30 11:08:11 +01:00
Luo, Yuanke
7471d8b13c [X86][AMX] Pre-checkin the test case for AMX undef and zero 2022-03-30 17:53:01 +08:00
Serge Pavlov
8160dd582b Revert "Mapping of FP operations to constrained intrinsics"
This reverts commit 115b3ace36.
Starting from this commit the buildbot sanitizer-x86_64-linux-bootstrap-msan
starts failing (build 10071). Reverted for investigation.
2022-03-30 16:46:43 +07:00
Luo, Yuanke
1141c8b6fc [X86][AMX] Fix bug for amx cast tranform
After combining amx cast operation, some amx cast intrinsic may be dead
code. This patch is to delete such dead code and avoid crash.
2022-03-30 17:22:30 +08:00
Vitaly Buka
15972e37ba [CodeGen] Avoid access after runtime
Insts must be destroyd before xParent
or it can read it with stack like this:
   0 in llvm::MachineInstr::getMF() const MachineInstr.cpp:637:3
   1 in getMF MachineInstr.h:302:50
   2 in removeNodeFromList MachineBasicBlock.cpp:163:32
2022-03-30 02:08:13 -07:00
Nikita Popov
6ae13b74d6 [MLIR] Remove LLVMVectorType
While this claims to be the base class for fixed and scalable
vectors, this is no longer the case since D94405. In fact,
LLVMVectorType is not usable, since the methods it declares are
never defined. Remove this leftover.

Differential Revision: https://reviews.llvm.org/D122707
2022-03-30 10:57:42 +02:00
Simon Pilgrim
bce954321a [X86] Add PR47857 test case 2022-03-30 09:51:36 +01:00
Liqin Weng
4cb85da811 [RISCV] Add CMIX isel pattern for (xor (and (xor rs1, rs3), rs2), rs3)
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D122702
2022-03-30 16:51:09 +08:00
bzcheeseman
4fec44b0e6 [mlir] Allow Diagnostic/InFlightDiagnostic to convert to FailureOr.
Allow conversion of a diagnostic to FailureOr. This conversion only results
in `failure` because in the case where operator LogicalResult would return
success, the FailureOr constructor would assert.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D122596
2022-03-30 01:37:20 -07:00
Luboš Luňák
a60e09509c add missing include for -DLLVM_ENABLE_MODULES=On 2022-03-30 10:31:59 +02:00
Simon Pilgrim
6697e3354f [X86] combineADC - fold ADC(C1,C2,Carry) -> ADC(0,C1+C2,Carry)
If we're not relying on the flag result, we can fold the constants together into the RHS immediate operand and set the LHS operand to zero, simplifying for further folds.

We could do something similar if the flag result is in use and the constant fold doesn't affect it, but I don't have any real test cases for this yet.

As suggested by @davezarzycki on Issue #35256

Differential Revision: https://reviews.llvm.org/D122482
2022-03-30 09:11:55 +01:00
Simon Pilgrim
d663166acb [CostModel][X86] Reduce cost of v2i64 icmp base cost on SSE2 targets
Based off the script from D103695, we were exaggerating the cost of the v2i64 comparison expansion using instruction count instead of effective throughput
2022-03-30 09:11:55 +01:00
Ingo Müller
e124f73b52 [mlir][docs] Convert block comments to line comments.
The op documentation of the ops of the scf dialect used /**/ style block
comments which doesn't seem to exists (anymore?).

Reviewed By: nicolasvasilache, ingomueller-net

Differential Revision: https://reviews.llvm.org/D122565
2022-03-30 08:08:42 +00:00
Fraser Cormack
75047577d6 [RISCV] Trim RVV isel pats matchable via DAG post-process
In D122512, several masked patterns were added to support lowering of
vector-predicated float-to-int and int-to-float conversions. With the
introduction of these patterns, all of the old "unmasked" patterns are
matchable via the DAG post-process introduced in D118810, once the relevant
opcode entries are set up in the helper table.

Locally this reduces the generated isel table by 4%.

Reviewed By: arcbbb

Differential Revision: https://reviews.llvm.org/D122637
2022-03-30 08:56:38 +01:00
Nikita Popov
ea043ea183 [MLIR] Avoid some pointer element type accesses
Determine the element type from the MLIR LLVMPointerType, rather
than the LLVM PointerType.
2022-03-30 10:00:51 +02:00
Nikita Popov
8a72391f60 [IR] Require intrinsic struct return type to be anonymous
This is an alternative to D122376. Rather than working around the
problem, this patch requires that struct return types in intrinsics
are anonymous/literal and adds auto-upgrade code to convert
existing uses of intrinsics with named struct types.

This ensures that the mapping between intrinsic name and
intrinsic function type is actually bijective, as it is supposed
to be.

This also fixes https://github.com/llvm/llvm-project/issues/37891.

Differential Revision: https://reviews.llvm.org/D122471
2022-03-30 09:51:24 +02:00
LLVM GN Syncbot
f54f448525 [gn build] Port 1410a4860e 2022-03-30 07:33:49 +00:00
Pavel Labath
1410a4860e [lldb] Remove vasprintf windows-compat implementation
We already have a VASprintf function for this purpose, so I'm switching
the remaining few users to that.
2022-03-30 09:32:35 +02:00
Markus Böck
e59335e891 [clang][DR] Add test for DR1227 and mark it as complete
DR: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1227

This DR has been implemented in Clang as far back as I could check. This patch simply adds a test and comment to mark it as complete.

Differential Revision: https://reviews.llvm.org/D122682
2022-03-30 09:25:52 +02:00
Pavel Labath
c484857b2e [lldb] Use =default in the ValueList class 2022-03-30 09:12:59 +02:00
Danny Mösch
b3079e8a7e [clang-tidy] Make test work on architectures which do not provide a __int128_t
See f10cee91ae. The test did still not run successful since the
`CHECK-MESSAGE` line is still read and considered even though the `#ifdef` removes the code if
`__int128_t` is not available. Now there is a fallback type in this case.
2022-03-30 08:03:32 +02:00
Serge Pavlov
115b3ace36 Mapping of FP operations to constrained intrinsics
A new function 'getConstrainedIntrinsic' is added, which for any gived
instruction returns id of the corresponding constrained intrinsic. If
there is no constrained counterpart for the instruction or the instruction
is already a constrained intrinsic, the function returns zero.

Differential Revision: https://reviews.llvm.org/D69562
2022-03-30 12:21:30 +07:00
Michael Kruse
793b7f903d [docs] Update LoopTerminology.
Includes 2 corrections:

 * Update irreducible control flow and add references to CycleTerminology;
   Natural loop is not the only definition of something looping in LLVM anymore.

 * Mention mustprogress loop and function attributes to be used
   instead of the llvm.sideeffect intrinsic.
2022-03-29 23:26:18 -05:00
Liqin Weng
7f81765898 [RISCV][NFC] Add immediate tests for the icmp instruction
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D122651
2022-03-30 02:51:26 +00:00
Chenbing Zheng
780eb9f586 [DAGCombine] add tests for bitreverse-shift optimization
This patch add some tests to show some optimization opportunities
for bitreverse-shift.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D121507
2022-03-30 09:50:28 +08:00
Zakk Chen
b578330754 [RISCV] Use maskedoff to decide mask policy for masked compare and vmsbf/vmsif/vmsof.
masked compare and vmsbf/vmsif/vmsof are always tail agnostic, we could
check maskedoff value to decide mask policy rather than have a addtional
policy operand.

Reviewed By: craig.topper, arcbbb

Differential Revision: https://reviews.llvm.org/D122456
2022-03-29 18:05:33 -07:00
Zakk Chen
10b2760da0 Revert "[RISCV] Add policy operand for masked compare and vmsbf/vmsif/vmsof IR"
This reverts commit 10fd2822b7.

I have a better implementation for those operations without the
additional policy operand.
masked compare and vmsbf/vmsif/vmsof are always tail agnostic so we could
assume undef maskedoff is mask agnostic.

Differential Revision: https://reviews.llvm.org/D122455
2022-03-29 18:05:33 -07:00
Dominic Chen
22a95dd3e6 Revert "[scudo] Wrap clang pragma to avoid GCC error"
Revert "[scudo] Add noreturn/pragma to suppress compiler warnings"

This reverts commit 686dcbe8b0.
This reverts commit 030d8262a6.
2022-03-29 17:52:20 -07:00
Dominic Chen
6ba8c8abe9 [scudo] Provide allocator declaration
Ensure that extern allocator declaration is visible before definition

Differential Revision: https://reviews.llvm.org/D121848
2022-03-29 17:39:45 -07:00
Dominic Chen
030d8262a6 [scudo] Wrap clang pragma to avoid GCC error
Fixes: [scudo] Add noreturn/pragma to suppress compiler warnings

Differential Revision: https://reviews.llvm.org/D121853
2022-03-29 17:36:33 -07:00
Roland McGrath
fd7ec90abd [lsan] On Fuchsia, don't use atexit hook for leak checks
This is a re-land of https://reviews.llvm.org/D86171 with fix.

Fuchsia's system libraries are instrumented and use the lsan
allocator for internal purposes.  So leak checking needs to run
after all atexit hooks and after the system libraries' internal
exit-time hooks.  The <zircon/sanitizer.h> hook API calls the
__sanitizer_process_exit_hook function at exactly the right time.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D88248
2022-03-29 17:13:55 -07:00
Michael Jones
9276074271 [libc][obvious] Add mfma to log2f
In the previous patch adding -mfma to functions that need it for windows
builds I missed log2f.

Differential Revision: https://reviews.llvm.org/D122693
2022-03-29 16:34:52 -07:00
Michael Jones
2f8829aba3 [libc] Add mfma option to functions that use fma
On Windows the functions that use fma don't properly include the fma
intrinsics unless -mfma is added to the compile options. This patch adds
the compile option to all of the functions that need it.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D122689
2022-03-29 16:23:36 -07:00
Michael Jones
4ac3f7e41a [libc][obvious] fix sqrt when long double is double
Previously, the "fsqrt" instruction was used on all x86_64 platforms
for finding the square root of long doubles. On long double is double
platforms (e.g. windows) this created errors. This patch changes square
root function for long doubles to be the same as the one for doubles if
long doubles are doubles.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D122688
2022-03-29 16:05:40 -07:00