platform/upstream/llvm.git
3 years ago[tests] Precommit test for D104140
Philip Reames [Fri, 16 Jul 2021 17:57:51 +0000 (10:57 -0700)]
[tests] Precommit test for D104140

3 years ago[mlir][sparse] minor cleanup of Merger
Aart Bik [Fri, 16 Jul 2021 16:02:58 +0000 (09:02 -0700)]
[mlir][sparse] minor cleanup of Merger

Removed inconsistent name prefixes, added consistency checks
on debug strings, added more assertions to verify assumptions
that may be lifted in the future.

Reviewed By: gussmith23

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

3 years ago[Clang] Add an empty builtins.h file.
Stefan Pintilie [Thu, 15 Jul 2021 14:23:23 +0000 (09:23 -0500)]
[Clang] Add an empty builtins.h file.

On Power PC some legacy compilers included a number of builtins in a
builtins.h header file. While this header file is not required to hold
builtins for clang some legacy code does try to include this file and so
this patch provides an empty version of that file.

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

3 years ago[RISCV] Rename the fixed vector vwmacc tests to have the 'm' in their filenames. NFC
Craig Topper [Fri, 16 Jul 2021 17:20:38 +0000 (10:20 -0700)]
[RISCV] Rename the fixed vector vwmacc tests to have the 'm' in their filenames. NFC

3 years ago[RISCV] Use tail agnostic policy for fixed vector vwmacc(u).
Craig Topper [Fri, 16 Jul 2021 17:17:36 +0000 (10:17 -0700)]
[RISCV] Use tail agnostic policy for fixed vector vwmacc(u).

This adds new pseudoinstructions with ForceTailAgnostic set. This
matches what we did for non-widening VMACC. We should move to a
tail policy operand on the pseudos when we expand the intrinsic
interface to include the tail policy.

3 years ago[RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC...
Craig Topper [Fri, 16 Jul 2021 17:01:05 +0000 (10:01 -0700)]
[RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC instructions. NFC

I'm preparing to add tail agnostic versions of VWMACC and VFWMACC
so this will make them more consistent.

3 years ago[docs] Update llvm-readelf supported options after D105532
Fangrui Song [Fri, 16 Jul 2021 17:40:30 +0000 (10:40 -0700)]
[docs] Update llvm-readelf supported options after D105532

3 years agosanitizer_common: add Semaphore
Dmitry Vyukov [Thu, 15 Jul 2021 15:15:48 +0000 (17:15 +0200)]
sanitizer_common: add Semaphore

Semaphore is a portable way to park/unpark threads.
The plan is to use it to implement a portable blocking
mutex in subsequent changes. Semaphore can also be used
to efficiently wait for other things (e.g. we currently
spin to synchronize thread creation and start).

Reviewed By: vitalybuka, melver

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

3 years ago[test] Extend negative stride backedge tests to cover signed comparisons
Philip Reames [Fri, 16 Jul 2021 17:24:41 +0000 (10:24 -0700)]
[test] Extend negative stride backedge tests to cover signed comparisons

3 years ago[X86FixupLEAs] Try again to transform the sequence LEA/SUB to SUB/SUB
Guozhi Wei [Fri, 16 Jul 2021 17:16:03 +0000 (10:16 -0700)]
[X86FixupLEAs] Try again to transform the sequence LEA/SUB to SUB/SUB

This patch transforms the sequence
    lea (reg1, reg2), reg3
    sub reg3, reg4
to two sub instructions
    sub reg1, reg4
    sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.

The modifications to TwoAddressInstructionPass is to ensure the operands of ADD
instruction has expected order (the dest register of LEA should be src register
of ADD).

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

3 years ago[SCEV] Add tests for known negative strides in trip count logic
Philip Reames [Fri, 16 Jul 2021 17:08:20 +0000 (10:08 -0700)]
[SCEV] Add tests for known negative strides in trip count logic

3 years ago[ELF][test] Avoid llvm-readelf/llvm-readobj one-dash long options
Fangrui Song [Fri, 16 Jul 2021 17:02:47 +0000 (10:02 -0700)]
[ELF][test] Avoid llvm-readelf/llvm-readobj one-dash long options

3 years agoRevert "[MachineVerifier] Diagnose invalid INSERT_SUBREGs"
Jon Roelofs [Fri, 16 Jul 2021 16:53:16 +0000 (09:53 -0700)]
Revert "[MachineVerifier] Diagnose invalid INSERT_SUBREGs"

This reverts commit dd57ba1a17b93dbe211d04cb2d4de5f6dc898d60.

It broke some tests: http://45.33.8.238/linux/51314/step_12.txt

3 years ago[X86] Regenerate twoaddr-lea.ll test checks.
Simon Pilgrim [Fri, 16 Jul 2021 14:14:05 +0000 (15:14 +0100)]
[X86] Regenerate twoaddr-lea.ll test checks.

3 years ago[DAG] SelectionDAG::MaskedElementsAreZero - assert we're calling with a vector. NFCI.
Simon Pilgrim [Fri, 16 Jul 2021 11:05:05 +0000 (12:05 +0100)]
[DAG] SelectionDAG::MaskedElementsAreZero - assert we're calling with a vector. NFCI.

Add an assertion that we've calling MaskedElementsAreZero with a vector op and that the DemandedElts arg is a matching width.

Makes the error a lot easier to grok when something else accidentally gets used.

3 years ago[MachineVerifier] Diagnose invalid INSERT_SUBREGs
Jon Roelofs [Wed, 14 Jul 2021 00:07:48 +0000 (17:07 -0700)]
[MachineVerifier] Diagnose invalid INSERT_SUBREGs

Differential revision: https://reviews.llvm.org/D105953

3 years ago[RISCV] Teach constant materialization that it can use zext.w at the end with Zba...
Craig Topper [Fri, 16 Jul 2021 16:23:17 +0000 (09:23 -0700)]
[RISCV] Teach constant materialization that it can use zext.w at the end with Zba to reduce number of instructions.

If the upper 32 bits are zero and bit 31 is set, we might be able to
use zext.w to fill in the zeros after using an lui and/or addi.

Most of this patch is plumbing the subtarget features into the constant
materialization.

Reviewed By: luismarques

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

3 years ago[RISCV] Add curly braces around a case body that declares variables. NFC
Craig Topper [Fri, 16 Jul 2021 01:06:59 +0000 (18:06 -0700)]
[RISCV] Add curly braces around a case body that declares variables. NFC

This is at the end of the switch so doesn't cause any issues now,
but if a new case is added it will break.

3 years ago[Verifier] Require same signature for intrinsic calls
Nikita Popov [Wed, 14 Jul 2021 20:21:06 +0000 (22:21 +0200)]
[Verifier] Require same signature for intrinsic calls

As suggested on D105733, this adds a verifier rule that calls to
intrinsics must match the signature of the intrinsic.

Without opaque pointers this is automatically enforced for all
calls, because the pointer types need to match. If the signatures
don't match, a pointer bitcast has to be inserted. For intrinsics
in particular, such bitcasts are not legal, because the address of
intrinsics cannot be taken.

With opaque pointers, there are no more pointer bitcasts, so it's
generally possible for the call and the callee signature to differ.
However, for intrinsics we still want to enforce that the signatures
must match, the same as was done before through the address taken
check.

We can't enforce this more generally for non-intrinsics, because
calls with mismatched signatures at the very least can legally
occur in unreachable code, and might also be valid in some other
cases, depending on how exactly the signatures differ.

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

3 years ago[NFC] Fix typo intrinisic
madhur13490 [Fri, 16 Jul 2021 16:13:48 +0000 (21:43 +0530)]
[NFC] Fix typo intrinisic

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

3 years ago[libcxx][modularisation] adds several headers to the module map
Christopher Di Bella [Thu, 15 Jul 2021 06:41:17 +0000 (06:41 +0000)]
[libcxx][modularisation] adds several headers to the module map

* <__algorithm/iter_swap.h>
* <__algorithm/swap_ranges.h>
* <__functional/is_transparent.h>
* <__memory/uses_allocator.h>
* <__ranges/drop_view.h>
* <__ranges/transform_view.h>
* <shared_mutex>
* <span>

Also updates header inclusions that were affected.

**NOTE:** This is a proper subset of D105932. Since the content has
already been LGTM'd, I intend to merge this patch without review,
pending green CI. I decided it would be better to move these changes
into their own commit since the former patch has undergone further
changes and will need yet another light review. In the event any of
that gets rolled back (for whatever reason), the changes in this patch
won't be affected.

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

3 years ago[flang][driver] Fix output filename generation in `flang`
Andrzej Warzynski [Fri, 16 Jul 2021 16:06:06 +0000 (17:06 +0100)]
[flang][driver] Fix output filename generation in `flang`

In the `flang` bash script, we need to be careful _when_ to use <output>
from `flang -c -o <output> <input>` when generating the relocatable
output file name.

In particular, we should use it in this case:
```compilation only
flang -c -o <output> <input>
```
but leave it for the final executable here:
```compile, assemble and link
flang  -o <output> <input>
```
This change is implemented in `get_relocatable_name`.

I've also taken the liberty to fix how errors from sub-commands are
reported (without this change, `flang` always returns `0` on failure).
This is implemented in `main`.

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

3 years ago[LoopInterchange] Check lcssa phis in the inner latch in scenarios of multi-level...
Congzhe Cao [Fri, 16 Jul 2021 15:47:11 +0000 (11:47 -0400)]
[LoopInterchange] Check lcssa phis in the inner latch in scenarios of multi-level nested loops

We already know that we need to check whether lcssa
phis are supported in inner loop exit block or in
outer loop exit block, and we have logic to check
them already. Presumably the inner loop latch does
not have lcssa phis and there is no code that deals
with lcssa phis in the inner loop latch. However,
that assumption is not true, when we have loops
with more than two-level nesting. This patch adds
checks for lcssa phis in the inner latch.

Reviewed By: Whitney

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

3 years ago[libc++] ci: Create ~/Library/LaunchAgents if it does not exist yet
Louis Dionne [Fri, 16 Jul 2021 15:46:47 +0000 (11:46 -0400)]
[libc++] ci: Create ~/Library/LaunchAgents if it does not exist yet

3 years agoMips/GlobalISel: Use LLT form of getMachineMemOperand
Matt Arsenault [Fri, 11 Jun 2021 16:17:32 +0000 (12:17 -0400)]
Mips/GlobalISel: Use LLT form of getMachineMemOperand

NFC here since it's just using a scalar anyway.

3 years agoGlobalISel: Preserve memory type for memset expansion
Matt Arsenault [Fri, 16 Jul 2021 15:25:07 +0000 (11:25 -0400)]
GlobalISel: Preserve memory type for memset expansion

3 years agoAArch64/GlobalISel: Update tests to use correct memory types
Matt Arsenault [Fri, 16 Jul 2021 13:19:23 +0000 (09:19 -0400)]
AArch64/GlobalISel: Update tests to use correct memory types

3 years ago[libc++] CI: Setup BuildKite agents through launchd
Louis Dionne [Fri, 16 Jul 2021 15:37:16 +0000 (11:37 -0400)]
[libc++] CI: Setup BuildKite agents through launchd

This makes sure that even if a node goes down, the BuildKite agent will
be started again when it goes back up.

3 years ago[mlir] Remove unused functions in LinalgOps.cpp
Alexander Belyaev [Fri, 16 Jul 2021 15:14:34 +0000 (17:14 +0200)]
[mlir] Remove unused functions in LinalgOps.cpp

3 years ago[Bazel] Delete deprecated gentbl rule
Geoffrey Martin-Noble [Fri, 16 Jul 2021 01:06:21 +0000 (18:06 -0700)]
[Bazel] Delete deprecated gentbl rule

This has been deprecated for a while. There are no users in tree and I'm
not aware of any out of tree users either.

Reviewed By: ftynse

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

3 years ago[PowerPC] Updated the error message of MASSV pass to mention vectorization
Masoud Ataei [Fri, 16 Jul 2021 14:45:09 +0000 (14:45 +0000)]
[PowerPC] Updated the error message of MASSV pass to mention vectorization
 is needed be enable on P8 and later targets.

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

3 years ago[runtimes] Simplify how we set the target triple
Louis Dionne [Wed, 14 Jul 2021 19:54:13 +0000 (15:54 -0400)]
[runtimes] Simplify how we set the target triple

Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE,
use that variable directly to populate the various XXXX_TARGET_TRIPLE
variables in the runtimes.

This re-applies 77396bbc98 and 5099e01568, which were reverted in
850b57c5fbe because they broke the build.

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

3 years ago[PowerPC] Update Refactored Load/Store Implementation, XForm VSX Patterns, and Tests
Amy Kwan [Wed, 14 Jul 2021 01:33:23 +0000 (20:33 -0500)]
[PowerPC] Update Refactored Load/Store Implementation, XForm VSX Patterns, and Tests

This patch includes the following updates to the load/store refactoring effort introduced in D93370:
 - Update various VSX patterns that use to "force" an XForm, to instead just XForm.
   This allows the ability for the patterns to compute the most optimal addressing
   mode (and to produce a DForm instruction when possible)
- Update pattern and test case for the LXVD2X/STXVD2X intrinsics
- Update LIT test cases that use to use the XForm instruction to use the DForm instruction

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

3 years agoRevert "[RISCV] Lower more BUILD_VECTOR sequences to RVV's VID"
Fraser Cormack [Fri, 16 Jul 2021 13:58:39 +0000 (14:58 +0100)]
Revert "[RISCV] Lower more BUILD_VECTOR sequences to RVV's VID"

This reverts commit a6ca88e908b5befcd9b0f8c8cb40f53095cc17bc.

More caution is required to avoid overflow/underflow. Thanks to the
santizers for catching this.

3 years ago[lldb][AArch64] Add tag packing and repetition memory tag manager
David Spickett [Wed, 31 Mar 2021 12:35:56 +0000 (13:35 +0100)]
[lldb][AArch64] Add tag packing and repetition memory tag manager

PackTags is used by to compress tags to go in the QMemTags packet
and be passed to ptrace when writing memory tags.

The behaviour of RepeatTagsForRange matches that described for QMemTags
in the GDB documentation:
https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets

In addition, unpacking tags with number of tags 0 now means
do not check that number of tags matches the range.
This will be used by lldb-server to unpack tags before repeating
them to fill the requested range.

Reviewed By: omjavaid

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

3 years ago[mlir] add missing build dependency
Alex Zinenko [Fri, 16 Jul 2021 13:20:07 +0000 (15:20 +0200)]
[mlir] add missing build dependency

3 years ago[mlir] replace llvm.mlir.cast with unrealized_conversion_cast
Alex Zinenko [Tue, 13 Jul 2021 08:55:35 +0000 (10:55 +0200)]
[mlir] replace llvm.mlir.cast with unrealized_conversion_cast

The dialect-specific cast between builtin (ex-standard) types and LLVM
dialect types was introduced long time before built-in support for
unrealized_conversion_cast. It has a similar purpose, but is restricted
to compatible builtin and LLVM dialect types, which may hamper
progressive lowering and composition with types from other dialects.
Replace llvm.mlir.cast with unrealized_conversion_cast, and drop the
operation that became unnecessary.

Also make unrealized_conversion_cast legal by default in
LLVMConversionTarget as the majority of convesions using it are partial
conversions that actually want the casts to persist in the IR. The
standard-to-llvm conversion, which is still expected to run last, cleans
up the remaining casts  standard-to-llvm conversion, which is still
expected to run last, cleans up the remaining casts

Reviewed By: nicolasvasilache

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

3 years agoGlobalISel: Remove dead function
Matt Arsenault [Thu, 15 Jul 2021 18:44:03 +0000 (14:44 -0400)]
GlobalISel: Remove dead function

3 years agoAMDGPU/GlobalISel: Preserve more memory types
Matt Arsenault [Thu, 15 Jul 2021 18:24:00 +0000 (14:24 -0400)]
AMDGPU/GlobalISel: Preserve more memory types

3 years agoAMDGPU/GlobalISel: Redo kernel argument load handling
Matt Arsenault [Thu, 15 Jul 2021 18:23:06 +0000 (14:23 -0400)]
AMDGPU/GlobalISel: Redo kernel argument load handling

This avoids relying on G_EXTRACT on unusual types, and also properly
decomposes structs into multiple registers. This also preserves the
LLTs in the memory operands.

3 years ago[InstrRef][FastISel] Support emitting DBG_INSTR_REF from fast-isel
Jeremy Morse [Fri, 16 Jul 2021 12:36:27 +0000 (13:36 +0100)]
[InstrRef][FastISel] Support emitting DBG_INSTR_REF from fast-isel

If you attach __attribute__((optnone)) to a function when using
optimisations, that function will use fast-isel instead of the usual
SelectionDAG method. This is a problem for instruction referencing,
because it means DBG_VALUEs of virtual registers will be created,
triggering some safety assertions in LiveDebugVariables. Those assertions
exist to detect exactly this scenario, where an unexpected piece of code is
generating virtual register references in instruction referencing mode.

Fix this by transforming the DBG_VALUEs created by fast-isel into
half-formed DBG_INSTR_REFs, after which they get patched up in
finalizeDebugInstrRefs. The test modified adds a fast-isel mode to the
instruction referencing isel test.

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

3 years ago[SLP] add tests for poison-safe bool logic reductions; NFC
Sanjay Patel [Fri, 16 Jul 2021 12:31:28 +0000 (08:31 -0400)]
[SLP] add tests for poison-safe bool logic reductions; NFC

More coverage for D105730

3 years agoSubstTemplateTypeParmType can contain an 'auto' type in their replacement type
serge-sans-paille [Thu, 15 Jul 2021 19:55:22 +0000 (21:55 +0200)]
SubstTemplateTypeParmType can contain an 'auto' type in their replacement type

This fixes bug 36064

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

3 years ago[AMDGPU][MC] Added missing isCall/isBranch flags
Dmitry Preobrazhensky [Fri, 16 Jul 2021 11:42:30 +0000 (14:42 +0300)]
[AMDGPU][MC] Added missing isCall/isBranch flags

Added isCall for S_CALL_B64; added isBranch for S_SUBVECTOR_LOOP_*.

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

3 years ago[PowerPC][AIX] Add warning when alignment is incompatible with XL
Zarko Todorovski [Fri, 16 Jul 2021 11:49:36 +0000 (07:49 -0400)]
[PowerPC][AIX] Add warning when alignment is incompatible with XL

https://reviews.llvm.org/D105659 implements ByVal handling in llc but
some cases are not compatible with existing XL compiler on AIX.  Adding
a clang warning for such cases.

Reviewed By: aaron.ballman

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

3 years ago[mlir] Move linalg::Expand/CollapseShapeOp to memref dialect.
Alexander Belyaev [Fri, 16 Jul 2021 11:31:02 +0000 (13:31 +0200)]
[mlir] Move linalg::Expand/CollapseShapeOp to memref dialect.

RFC: https://llvm.discourse.group/t/rfc-reshape-ops-restructuring/3310

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

3 years agoUse update_test_checks.py to auto-generate check lines
Serge Pavlov [Fri, 16 Jul 2021 11:19:31 +0000 (18:19 +0700)]
Use update_test_checks.py to auto-generate check lines

3 years ago[mlir] add an interface to support custom types in LLVM dialect pointers
Alex Zinenko [Thu, 15 Jul 2021 16:16:07 +0000 (18:16 +0200)]
[mlir] add an interface to support custom types in LLVM dialect pointers

This may be necessary in partial multi-stage conversion when a container type
from dialect A containing types from dialect B goes through the conversion
where only dialect A is converted to the LLVM dialect. We will need to keep a
pointer-to-non-LLVM type in the IR until a further conversion can convert
dialect B types to LLVM types.

Reviewed By: wsmoses

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

3 years ago[AArch64] Update Cortex-A55 SchedModel to improve LDP scheduling
Nicholas Guy [Mon, 12 Jul 2021 09:36:35 +0000 (10:36 +0100)]
[AArch64] Update Cortex-A55 SchedModel to improve LDP scheduling

Specifying the latencies of specific LDP variants appears to improve
performance almost universally.

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

3 years ago[LV] Avoid scalable vectorization for loops containing alloca
Kerry McLaughlin [Fri, 16 Jul 2021 10:04:20 +0000 (11:04 +0100)]
[LV] Avoid scalable vectorization for loops containing alloca

This patch returns an Invalid cost from getInstructionCost() for alloca
instructions if the VF is scalable, as otherwise loops which contain
these instructions will crash when attempting to scalarize the alloca.

Reviewed By: sdesmalen

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

3 years ago[AArch64][SME] Add load and store instructions
Cullen Rhodes [Fri, 16 Jul 2021 09:14:08 +0000 (09:14 +0000)]
[AArch64][SME] Add load and store instructions

This patch adds support for following contiguous load and store
instructions:

  * LD1B, LD1H, LD1W, LD1D, LD1Q
  * ST1B, ST1H, ST1W, ST1D, ST1Q

A new register class and operand is added for the 32-bit vector select
register W12-W15. The differences in the following tests which have been
re-generated are caused by the introduction of this register class:

  * llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
  * llvm/test/CodeGen/AArch64/GlobalISel/regbank-inlineasm.mir
  * llvm/test/CodeGen/AArch64/stp-opt-with-renaming-reserved-regs.mir
  * llvm/test/CodeGen/AArch64/stp-opt-with-renaming.mir

D88663 attempts to resolve the issue with the store pair test
differences in the AArch64 load/store optimizer.

The GlobalISel differences are caused by changes in the enum values of
register classes, tests have been updated with the new values.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06

Reviewed By: CarolineConcatto

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

3 years ago[lldb][AArch64] Refactor memory tag range handling
David Spickett [Thu, 8 Jul 2021 12:17:43 +0000 (13:17 +0100)]
[lldb][AArch64] Refactor memory tag range handling

Previously GetMemoryTagManager checked many things in one:
* architecture supports memory tagging
* process supports memory tagging
* memory range isn't inverted
* memory range is all tagged

Since writing follow up patches for tag writing (in review
at the moment) it has become clear that this gets unwieldy
once we add the features needed for that.

It also implies that the memory tag manager is tied to the
range you used to request it with but it is not. It's a per
process object.

Instead:
* GetMemoryTagManager just checks architecture and process.
* Then the MemoryTagManager can later be asked to check a
  memory range.

This is better because:
* We don't imply that range and manager are tied together.
* A slightly diferent range calculation for tag writing
  doesn't add more code to Process.
* Range checking code can now be unit tested.

Reviewed By: omjavaid

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

3 years agoReland "[LV] Print remark when loop cannot be vectorized due to invalid costs."
Sander de Smalen [Thu, 15 Jul 2021 14:32:31 +0000 (15:32 +0100)]
Reland "[LV] Print remark when loop cannot be vectorized due to invalid costs."

The original patch was:
  https://reviews.llvm.org/D105806

There were some issues with undeterministic behaviour of the sorting
function, which led to scalable-call.ll passing and/or failing. This
patch fixes the issue by numbering all instructions in the array first,
and using that number as the order, which should provide a consistent
ordering.

This reverts commit a607f64118240f70bf1b14ec121b65f49d63800d.

3 years ago[RISCV] Lower more BUILD_VECTOR sequences to RVV's VID
Fraser Cormack [Thu, 24 Jun 2021 15:32:46 +0000 (16:32 +0100)]
[RISCV] Lower more BUILD_VECTOR sequences to RVV's VID

This patch teaches the compiler to identify a wider variety of
`BUILD_VECTOR`s which form integer arithmetic sequences, and to lower
them to `vid.v` with modifications for non-unit steps and non-zero
addends.

The sequences handled by this optimization must either be monotonically
increasing or decreasing. Consecutive elements holding the same value
indicate a fractional step which, while simple mathematically,
becomes more complex to handle both in the realm of lossy integer
division and in the presence of `undef`s.

For example, a common "interleaving" shuffle index will be lowered by
LLVM to both `<0,u,1,u,2,...>` and `<u,0,u,1,u,...>` `BUILD_VECTOR`
nodes. Either of these would ideally be lowered to `vid.v` shifted right
by 1. Detection of this sequence in presence of general `undef` values
is more complicated, however: `<0,u,u,1,>` could match either
`<0,0,0,1,>` or `<0,0,1,1,>` depending on later values in the sequence.
Both are possible, so backtracking or multiple passes is inevitable.

Sticking to monotonic sequences keeps the logic simpler as it can be
done in one pass. Fractional steps will likely be a separate
optimization in a future patch.

Reviewed By: craig.topper

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

3 years ago[MLIR][NFC] Improve doc comment and delete stale comment
Uday Bondhugula [Fri, 16 Jul 2021 09:29:16 +0000 (14:59 +0530)]
[MLIR][NFC] Improve doc comment and delete stale comment

Remove duplicate and stale doc comment on affineParallelize. NFC.

3 years ago[llvm][tools] Hide unrelated llvm-cfi-verify options
Timm Bäder [Fri, 16 Jul 2021 08:17:41 +0000 (10:17 +0200)]
[llvm][tools] Hide unrelated llvm-cfi-verify options

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

3 years ago[analyzer] Do not assume that all pointers have the same bitwidth as void*
Vince Bridgers [Wed, 14 Jul 2021 12:00:14 +0000 (07:00 -0500)]
[analyzer] Do not assume that all pointers have the same bitwidth as void*

This change addresses this assertion that occurs in a downstream
compiler with a custom target.

```APInt.h:1151: bool llvm::APInt::operator==(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"'```

No covering test case is susbmitted with this change since this crash
cannot be reproduced using any upstream supported target. The test case
that exposes this issue is as simple as:

```lang=c++
  void test(int * p) {
    int * q = p-1;
    if (q) {}
    if (q) {} // crash
    (void)q;
  }
```

The custom target that exposes this problem supports two address spaces,
16-bit `char`s, and a `_Bool` type that maps to 16-bits. There are no upstream
supported targets with similar attributes.

The assertion appears to be happening as a result of evaluating the
`SymIntExpr` `(reg_$0<int * p>) != 0U` in `VisitSymIntExpr` located in
`SimpleSValBuilder.cpp`. The `LHS` is evaluated to `32b` and the `RHS` is
evaluated to `16b`. This eventually leads to the assertion in `APInt.h`.

While this change addresses the crash and passes LITs, two follow-ups
are required:
  1) The remainder of `getZeroWithPtrWidth()` and `getIntWithPtrWidth()`
     should be cleaned up following this model to prevent future
     confusion.
  2) We're not sure why references are found along with the modified
     code path, that should not be the case. A more principled
     fix may be found after some further comprehension of why this
     is the case.

Acks: Thanks to @steakhal and @martong for the discussions leading to this
fix.

Reviewed By: NoQ

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

3 years agoReformat files.
Simon Giesecke [Wed, 14 Jul 2021 08:21:16 +0000 (08:21 +0000)]
Reformat files.

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

3 years agoUse ManagedStatic and lazy initialization of cl::opt in libSupport to make it free...
Mehdi Amini [Thu, 15 Jul 2021 23:52:44 +0000 (23:52 +0000)]
Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

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

3 years agoRevert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make...
Mehdi Amini [Fri, 16 Jul 2021 07:34:41 +0000 (07:34 +0000)]
Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"

This reverts commit af9321739b20becf170e6bb5060b8d780e1dc8dd.
Still some specific config broken in some way that requires more
investigation.

3 years agoRevert "[llvm][tools] Hide unrelated llvm-cfi-verify options"
Timm Bäder [Fri, 16 Jul 2021 07:30:57 +0000 (09:30 +0200)]
Revert "[llvm][tools] Hide unrelated llvm-cfi-verify options"

This reverts commit 7c63726072005cc331bb21694c9022e6d18a3b93.

3 years ago[llvm][tools] Hide unrelated llvm-cfi-verify options
Timm Bäder [Thu, 15 Jul 2021 11:01:00 +0000 (13:01 +0200)]
[llvm][tools] Hide unrelated llvm-cfi-verify options

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

3 years ago[llvm-mca][JSON] Store extra information about driver flags used for the simulation
Marcos Horro [Fri, 16 Jul 2021 07:10:50 +0000 (09:10 +0200)]
[llvm-mca][JSON] Store extra information about driver flags used for the simulation

Added information stored in PipelineOptions and the MCSubtargetInfo.

Bug: https://bugs.llvm.org/show_bug.cgi?id=51041

Reviewed By: andreadb

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

3 years ago[analyzer] Handle << operator for std::unique_ptr
Deep Majumder [Fri, 16 Jul 2021 07:04:30 +0000 (12:34 +0530)]
[analyzer] Handle << operator for std::unique_ptr

    This patch handles the `<<` operator defined for `std::unique_ptr` in
    the std namespace (ignores custom overloads of the operator).

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

3 years agoUse ManagedStatic and lazy initialization of cl::opt in libSupport to make it free...
Mehdi Amini [Thu, 15 Jul 2021 23:52:44 +0000 (23:52 +0000)]
Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

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

3 years agoFix mismatch between the provisioning of asyncExecutors and the actual thread count...
Mehdi Amini [Fri, 16 Jul 2021 06:49:57 +0000 (06:49 +0000)]
Fix mismatch between the provisioning of asyncExecutors and the actual thread count currently in the context (NFC)

This fixes an assert in some deployment where the threadpool is
customized.

3 years ago[debugserver] Un-conditionalize code guarded by macOS 10.10 checks
Jonas Devlieghere [Fri, 16 Jul 2021 06:16:43 +0000 (23:16 -0700)]
[debugserver] Un-conditionalize code guarded by macOS 10.10 checks

We've been requiring macOS 10.11 since 2018 so there's no point in
keeping code for 10.10 around.

3 years ago[profile] Decommit memory after counter relocation
Petr Hosek [Sun, 21 Feb 2021 06:11:33 +0000 (22:11 -0800)]
[profile] Decommit memory after counter relocation

After we relocate counters, we no longer need to keep the original copy
around so we can return the memory back to the operating system.

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

3 years agoFix typo in test
Serge Pavlov [Fri, 16 Jul 2021 04:57:10 +0000 (11:57 +0700)]
Fix typo in test

3 years ago[LSR] Handle case 1*reg => reg. PR50918
Max Kazantsev [Fri, 16 Jul 2021 04:31:15 +0000 (11:31 +0700)]
[LSR] Handle case 1*reg => reg. PR50918

This patch addresses assertion failure in case when the only found formula for LSR
is `1*reg => reg` which was supposed to be an impossible situation, however there
is a test that shows it is possible.

In this case, we can use scale register with scale of 1 as the missing base register.

Reviewed By: huihuiz, reames
Differential Revision: https://reviews.llvm.org/D105009

3 years ago[analyzer] Model comparision methods of std::unique_ptr
Deep Majumder [Fri, 16 Jul 2021 04:24:05 +0000 (09:54 +0530)]
[analyzer] Model comparision methods of std::unique_ptr

This patch handles all the comparision methods (defined via overloaded
operators) on std::unique_ptr. These operators compare the underlying
pointers, which is modelled by comparing the corresponding inner-pointer
SVal. There is also a special case for comparing the same pointer.

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

3 years ago[TableGen] Allow isAllocatable inheritence from any superclass
Carl Ritson [Fri, 16 Jul 2021 03:13:29 +0000 (12:13 +0900)]
[TableGen] Allow isAllocatable inheritence from any superclass

When setting Allocatable on a generated register class check all
superclasses and set Allocatable true if any superclass is
allocatable.

Without this change generated register classes based on an
allocatable class may end up unallocatable due to the topological
inheritance order.

This change primarily effects AMDGPU backend; however, there are
a few changes in MIPs GlobalISel register constraints as a result.

Reviewed By: kparzysz

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

3 years ago[lld-macho] Optimize bind opcodes with multiple passes
Vincent Lee [Fri, 16 Jul 2021 01:29:05 +0000 (18:29 -0700)]
[lld-macho] Optimize bind opcodes with multiple passes

In D105866, we used an intermediate container to store a list of opcodes. Here,
we use that data structure to help us perform optimization passes that would allow
a more efficient encoding of bind opcodes. Currently, the functionality mirrors the
optimization pass {1,2} done in ld64 for bind opcodes under optimization gate
to prevent slight regressions.

Reviewed By: int3, #lld-macho

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

3 years ago[Attributor] Add support for compound assignment for ChangeStatus
Shilei Tian [Fri, 16 Jul 2021 03:51:38 +0000 (23:51 -0400)]
[Attributor] Add support for compound assignment for ChangeStatus

A common use of `ChangeStatus` is as follows:
```
ChangeStatus Changed = ChangeStatus::UNCHANGED;
Changed |= foo();
```
where `foo` returns `ChangeStatus` as well. Currently `ChangeStatus` doesn't
support compound assignment, we have to write as
```
Changed = Changed | foo();
```
which is not that convenient.

This patch add the support for compound assignment for `ChangeStatus`. Compound
assignment is usually implemented as a member function, and binary arithmetic
operator is therefore implemented using compound assignment. However, unlike
regular C++ class, enum class doesn't support member functions. As a result, they
can only be implemented in the way shown in the patch.

Reviewed By: jdoerfert

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

3 years agoRevert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make...
Mehdi Amini [Fri, 16 Jul 2021 03:46:22 +0000 (03:46 +0000)]
Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"

This reverts commit 42f588f39c5ce6f521e3709b8871d1fdd076292f.
Broke some buildbots

3 years agoUse ManagedStatic and lazy initialization of cl::opt in libSupport to make it free...
Mehdi Amini [Thu, 15 Jul 2021 23:52:44 +0000 (23:52 +0000)]
Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer

We can build it with -Werror=global-constructors now. This helps
in situation where libSupport is embedded as a shared library,
potential with dlopen/dlclose scenario, and when command-line
parsing or other facilities may not be involved. Avoiding the
implicit construction of these cl::opt can avoid double-registration
issues and other kind of behavior.

Reviewed By: lattner, jpienaar

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

3 years ago[MLIR] [Python ODS] Use @builtins.property for cases where 'property' is already...
John Demme [Fri, 16 Jul 2021 02:03:48 +0000 (19:03 -0700)]
[MLIR] [Python ODS] Use @builtins.property for cases where 'property' is already defined

In cases where an operation has an argument or result named 'property', the
ODS-generated python fails on import because the `@property` resolves to the
`property` operation argument instead of the builtin `@property` decorator. We
should always use the fully qualified decorator name.

Reviewed By: mikeurbach

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

3 years ago[gn build] Port 766a08df12c1
LLVM GN Syncbot [Fri, 16 Jul 2021 02:23:45 +0000 (02:23 +0000)]
[gn build] Port 766a08df12c1

3 years ago[gn build] port 766a08df12c1
Nico Weber [Fri, 16 Jul 2021 02:23:14 +0000 (22:23 -0400)]
[gn build] port 766a08df12c1

3 years ago[NFC][OpenMP][Offloading] Replaced explicit parallel level computation with function...
Shilei Tian [Fri, 16 Jul 2021 02:20:54 +0000 (22:20 -0400)]
[NFC][OpenMP][Offloading] Replaced explicit parallel level computation with function `__kmpc_parallel_level`

There are two places in current deviceRTLs where it computes parallel level explicitly,
which is basically the functionality of `__kmpc_parallel_level`. Starting from
D105787, we plan to introduce a series of function call folding based on information
that can be deducted during compilation time. Computation of parallel level is
the next target. This patch makes steps for the optimization.

Reviewed By: jdoerfert

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

3 years ago[libc++] Add a job running GCC with C++11
Louis Dionne [Thu, 15 Jul 2021 13:46:36 +0000 (09:46 -0400)]
[libc++] Add a job running GCC with C++11

This configuration is interesting because GCC has a different level of
strictness for some C++ rules. In particular, it implements the older
standards more stringently than Clang, which can help find places where
we are non-conforming (especially in the test suite).

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

3 years ago[Frontend] Only compile modules if not already finalized
Ben Barham [Fri, 16 Jul 2021 01:24:09 +0000 (18:24 -0700)]
[Frontend] Only compile modules if not already finalized

It was possible to re-add a module to a shared in-memory module cache
when search paths are changed. This can eventually cause a crash if the
original module is referenced after this occurs.
  1. Module A depends on B
  2. B exists in two paths C and D
  3. First run only has C on the search path, finds A and B and loads
     them
  4. Second run adds D to the front of the search path. A is loaded and
     contains a reference to the already compiled module from C. But
     searching finds the module from D instead, causing a mismatch
  5. B and the modules that depend on it are considered out of date and
     thus rebuilt
  6. The recompiled module A is added to the in-memory cache, freeing
     the previously inserted one

This can never occur from a regular clang process, but is very easy to
do through the API - whether through the use of a shared case or just
running multiple compilations from a single `CompilerInstance`. Update
the compilation to return early if a module is already finalized so that
the pre-condition in the in-memory module cache holds.

Resolves rdar://78180255

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

3 years ago[test] Use double pound to denote comments.
Daniel Rodríguez Troitiño [Thu, 15 Jul 2021 21:37:33 +0000 (14:37 -0700)]
[test] Use double pound to denote comments.

Use double pound at the start of the line to differentiate comments from
statements for Lit or FileCheck.

I will also use this small commit to check my commit access.

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

3 years ago[mlir][spirv] Add support for GLSL FMix
Weiwei Li [Thu, 15 Jul 2021 23:25:56 +0000 (07:25 +0800)]
[mlir][spirv] Add support for GLSL FMix

Add spv.GLSL.FMix opertaion.

co-authered-by: Alan Liu <alanliu.yf@gmail.com>

Reviewed By: mravishankar

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

3 years ago[lld-macho] Use intermediate arrays to store opcodes
Vincent Lee [Sat, 10 Jul 2021 00:25:29 +0000 (17:25 -0700)]
[lld-macho] Use intermediate arrays to store opcodes

We want to incorporate some of the optimization passes in bind opcodes from ld64.
This revision makes no functional changes but to start storing opcodes in intermediate
containers in preparation for implementing the optimization passes in a follow-up revision.

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

3 years ago[asan] Slightly modified the documentation.
Kirill Stoimenov [Thu, 15 Jul 2021 20:53:56 +0000 (13:53 -0700)]
[asan] Slightly modified the documentation.

The goal of this change is to test if I can commit changes.

Reviewed By: kcc

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

3 years agoRevert "tsan: make obtaining current PC faster"
Nico Weber [Thu, 15 Jul 2021 23:29:04 +0000 (19:29 -0400)]
Revert "tsan: make obtaining current PC faster"

This reverts commit e33446ea58b8357dd8b79eb39140a1de2baff1ae.
Doesn't build on mac, and causes other problems. See reports
on https://reviews.llvm.org/D106046 and https://reviews.llvm.org/D106081

Also revert follow-up "tsan: strip top inlined internal frames"
This reverts commit 7b302fc9b04c7991cdb869b65316e0d72e41042e.

3 years agoGlobalISel: Surface offsets parameter from ComputeValueVTs
Matt Arsenault [Thu, 15 Jul 2021 16:29:50 +0000 (12:29 -0400)]
GlobalISel: Surface offsets parameter from ComputeValueVTs

3 years agoAMDGPU/GlobalISel: Fix incorrect memory types in test
Matt Arsenault [Thu, 15 Jul 2021 16:16:15 +0000 (12:16 -0400)]
AMDGPU/GlobalISel: Fix incorrect memory types in test

3 years agoGlobalISel: Track argument pointeriness with arg flags
Matt Arsenault [Wed, 14 Jul 2021 18:03:18 +0000 (14:03 -0400)]
GlobalISel: Track argument pointeriness with arg flags

Since we're still building on top of the MVT based infrastructure, we
need to track the pointer type/address space on the side so we can end
up with the correct pointer LLTs when interpreting CCValAssigns.

3 years ago[lldb] Add AllocateMemory/DeallocateMemory to the SBProcess API
Peter S. Housel [Thu, 15 Jul 2021 22:42:28 +0000 (00:42 +0200)]
[lldb] Add AllocateMemory/DeallocateMemory to the SBProcess API

This change adds AllocateMemory and DeallocateMemory methods to the SBProcess
API, so that clients can allocate and deallocate memory blocks within the
process being debugged (for storing JIT-compiled code or other uses).

(I am developing a debugger + REPL using the API; it will need to store
JIT-compiled code within the target.)

Reviewed By: clayborg, jingham

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

3 years ago[NFC][hwasan] Remove default arguments in internal class
Vitaly Buka [Thu, 15 Jul 2021 22:16:29 +0000 (15:16 -0700)]
[NFC][hwasan] Remove default arguments in internal class

3 years ago[PowerPC] Add PowerPC population count, reversed load and store related builtins...
Victor Huang [Thu, 15 Jul 2021 22:21:54 +0000 (17:21 -0500)]
[PowerPC] Add PowerPC population count, reversed load and store related builtins and instrinsics for XL compatibility

This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtins and instrisics for population
count, reversed load and store related operations.

Reviewed By: nemanjai, #powerpc

Differential revision: https://reviews.llvm.org/D106021

3 years ago[AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if possible
Shilei Tian [Thu, 15 Jul 2021 22:23:12 +0000 (18:23 -0400)]
[AbstractAttributor] Fold function calls to `__kmpc_is_spmd_exec_mode` if possible

In the device runtime there are many function calls to `__kmpc_is_spmd_exec_mode`
to query the execution mode of current kernels. In many cases, user programs
only contain target region executing in one mode. As a consequence, those runtime
function calls will only return one value. If we can get rid of these function
calls during compliation, it can potentially improve performance.

In this patch, we use `AAKernelInfo` to analyze kernel execution. Basically, for
each kernel (device) function `F`, we collect all kernel entries `K` that can
reach `F`. A new AA, `AAFoldRuntimeCall`, is created for each call site. In each
iteration, it will check all reaching kernel entries, and update the folded value
accordingly.

In the future we will support more function.

Reviewed By: jdoerfert

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

3 years agoGlobalISel: Introduce GenericMachineInstr classes and derivatives for idiomatic LLVM...
Amara Emerson [Fri, 9 Jul 2021 22:48:47 +0000 (15:48 -0700)]
GlobalISel: Introduce GenericMachineInstr classes and derivatives for idiomatic LLVM RTTI.

This adds some level of type safety, allows helper functions to be added for
specific opcodes for free, and also allows us to succinctly check for class
membership with the usual dyn_cast/isa/cast functions.

To start off with, add variants for the different load/store operations with some
places using it.

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

3 years ago[libc] Fix typos in x86_64/FEnv.h
Roland McGrath [Thu, 15 Jul 2021 22:07:07 +0000 (15:07 -0700)]
[libc] Fix typos in x86_64/FEnv.h

Reviewed By: sivachandra

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

3 years ago[LLDB][GUI] Add Process Attach form
Omar Emara [Thu, 15 Jul 2021 21:33:30 +0000 (14:33 -0700)]
[LLDB][GUI] Add Process Attach form

This patch adds a form window to attach a process, either by PID or by
name. This patch also adds support for dynamic field visibility such
that the form delegate can hide or show certain fields based on some
conditions.

Reviewed By: clayborg

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

3 years ago[DependenceAnalysis] Guard analysis using getPointerBase().
Eli Friedman [Thu, 15 Jul 2021 20:49:13 +0000 (13:49 -0700)]
[DependenceAnalysis] Guard analysis using getPointerBase().

D104806 broke some uses of getMinusSCEV() in DependenceAnalysis:
subtraction with different pointer bases returns a SCEVCouldNotCompute.
Make sure we avoid cases involving such subtractions.

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

3 years ago[X86] Fix handling of maskmovdqu in X32
Harald van Dijk [Thu, 15 Jul 2021 21:56:08 +0000 (22:56 +0100)]
[X86] Fix handling of maskmovdqu in X32

The maskmovdqu instruction is an odd one: it has a 32-bit and a 64-bit
variant, the former using EDI, the latter RDI, but the use of the
register is implicit. In 64-bit mode, a 0x67 prefix can be used to get
the version using EDI, but there is no way to express this in
assembly in a single instruction, the only way is with an explicit
addr32.

This change adds support for the instruction. When generating assembly
text, that explicit addr32 will be added. When not generating assembly
text, it will be kept as a single instruction and will be emitted with
that 0x67 prefix. When parsing assembly text, it will be re-parsed as
ADDR32 followed by MASKMOVDQU64, which still results in the correct
bytes when converted to machine code.

The same applies to vmaskmovdqu as well.

Reviewed By: craig.topper

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

3 years ago[SLP] avoid leaking poison in reduction of safe boolean logic ops
Sanjay Patel [Thu, 15 Jul 2021 20:47:51 +0000 (16:47 -0400)]
[SLP] avoid leaking poison in reduction of safe boolean logic ops

This bug was introduced with D105730 / 25ee55c0baff .

If we are not converting all of the operations of a reduction
into a vector op, we need to preserve the existing select form
of the remaining ops. Otherwise, we are potentially leaking
poison where it did not in the original code.

Alive2 agrees that the version that freezes some inputs
and then falls back to scalar is correct:
https://alive2.llvm.org/ce/z/erF4K2