#
810567dc |
| 16-Mar-2020 |
Arthur Eubanks <aeubanks@google.com> |
[X86] Codegen for preallocated
See https://reviews.llvm.org/D74651 for the preallocated IR constructs and LangRef changes.
In X86TargetLowering::LowerCall(), if a call is preallocated, record each
[X86] Codegen for preallocated
See https://reviews.llvm.org/D74651 for the preallocated IR constructs and LangRef changes.
In X86TargetLowering::LowerCall(), if a call is preallocated, record each argument's offset from the stack pointer and the total stack adjustment. Associate the call Value with an integer index. Store the info in X86MachineFunctionInfo with the integer index as the key.
This adds two new target independent ISDOpcodes and two new target dependent Opcodes corresponding to @llvm.call.preallocated.{setup,arg}.
The setup ISelDAG node takes in a chain and outputs a chain and a SrcValue of the preallocated call Value. It is lowered to a target dependent node with the SrcValue replaced with the integer index key by looking in X86MachineFunctionInfo. In X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to an %esp adjustment, the exact amount determined by looking in X86MachineFunctionInfo with the integer index key.
The arg ISelDAG node takes in a chain, a SrcValue of the preallocated call Value, and the arg index int constant. It produces a chain and the pointer fo the arg. It is lowered to a target dependent node with the SrcValue replaced with the integer index key by looking in X86MachineFunctionInfo. In X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to a lea of the stack pointer plus an offset determined by looking in X86MachineFunctionInfo with the integer index key.
Force any function containing a preallocated call to use the frame pointer.
Does not yet handle a setup without a call, or a conditional call. Does not yet handle musttail. That requires a LangRef change first.
Tried to look at all references to inalloca and see if they apply to preallocated. I've made preallocated versions of tests testing inalloca whenever possible and when they make sense (e.g. not alloca related, inalloca edge cases).
Aside from the tests added here, I checked that this codegen produces correct code for something like
``` struct A { A(); A(A&&); ~A(); };
void bar() { foo(foo(foo(foo(foo(A(), 4), 5), 6), 7), 8); } ```
by replacing the inalloca version of the .ll file with the appropriate preallocated code. Running the executable produces the same results as using the current inalloca implementation.
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77689
show more ...
|
#
3e315697 |
| 18-May-2020 |
Matt Arsenault <Matthew.Arsenault@amd.com> |
DAG: Use correct pointer size for llvm.ptrmask
This was ignoring the address space, and would assert on address spaces with a different size from the default.
|
#
52e98f62 |
| 17-May-2020 |
Nikita Popov <nikita.ppv@gmail.com> |
[Alignment] Remove unnecessary getValueOrABITypeAlignment calls (NFC)
Now that load/store alignment is required, we no longer need most of them. Also switch the getLoadStoreAlignment() helper to ret
[Alignment] Remove unnecessary getValueOrABITypeAlignment calls (NFC)
Now that load/store alignment is required, we no longer need most of them. Also switch the getLoadStoreAlignment() helper to return Align instead of MaybeAlign.
show more ...
|
#
4f04db4b |
| 15-May-2020 |
Eli Friedman <efriedma@quicinc.com> |
AllocaInst should store Align instead of MaybeAlign.
Along the lines of D77454 and D79968. Unlike loads and stores, the default alignment is getPrefTypeAlign, to match the existing handling in vari
AllocaInst should store Align instead of MaybeAlign.
Along the lines of D77454 and D79968. Unlike loads and stores, the default alignment is getPrefTypeAlign, to match the existing handling in various places, including SelectionDAG and InstCombine.
Differential Revision: https://reviews.llvm.org/D80044
show more ...
|
#
11aa3707 |
| 14-May-2020 |
Eli Friedman <efriedma@quicinc.com> |
StoreInst should store Align, not MaybeAlign
This is D77454, except for stores. All the infrastructure work was done for loads, so the remaining changes necessary are relatively small.
Differentia
StoreInst should store Align, not MaybeAlign
This is D77454, except for stores. All the infrastructure work was done for loads, so the remaining changes necessary are relatively small.
Differential Revision: https://reviews.llvm.org/D79968
show more ...
|
#
accc6b55 |
| 04-Apr-2020 |
Eli Friedman <efriedma@quicinc.com> |
LoadInst should store Align, not MaybeAlign.
The fact that loads and stores can have the alignment missing is a constant source of confusion: code that usually works can break down in rare cases. S
LoadInst should store Align, not MaybeAlign.
The fact that loads and stores can have the alignment missing is a constant source of confusion: code that usually works can break down in rare cases. So fix the LoadInst API so the alignment is never missing.
To reduce the number of changes required to make this work, IRBuilder and certain LoadInst constructors will grab the module's datalayout and compute the alignment automatically. This is the same alignment instcombine would eventually apply anyway; we're just doing it earlier. There's a minor risk that the way we're retrieving the datalayout could break out-of-tree code, but I don't think that's likely.
This is the last in a series of patches, so most of the necessary changes have already been merged.
Differential Revision: https://reviews.llvm.org/D77454
show more ...
|
#
a31f4c52 |
| 07-May-2020 |
Kerry McLaughlin <kerry.mclaughlin@arm.com> |
[SVE][CodeGen] Fix legalisation for scalable types
Summary: This patch handles illegal scalable types when lowering IR operations, addressing several places where the value of isScalableVector() is
[SVE][CodeGen] Fix legalisation for scalable types
Summary: This patch handles illegal scalable types when lowering IR operations, addressing several places where the value of isScalableVector() is ignored.
For types such as <vscale x 8 x i32>, this means splitting the operations. In this example, we would split it into two operations of type <vscale x 4 x i32> for the low and high halves.
In cases such as <vscale x 2 x i32>, the elements in the vector will be promoted. In this case they will be promoted to i64 (with a vector of type <vscale x 2 x i64>)
Reviewers: sdesmalen, efriedma, huntergr
Reviewed By: efriedma
Subscribers: david-arm, tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78812
show more ...
|
#
d1ff003f |
| 29-Mar-2019 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values
We allocated a suitably aligned frame index so we know that all the values have ABI alignment. For MIPS this avoids using p
[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values
We allocated a suitably aligned frame index so we know that all the values have ABI alignment. For MIPS this avoids using pair of lwl + lwr instructions instead of a single lw. I found this when compiling CHERI pure capability code where we can't use the lwl/lwr unaligned loads/stores and and were to falling back to a byte load + shift + or sequence.
This should save a few instructions for MIPS and possibly other backends that don't have fast unaligned loads/stores. It also improves code generation for CodeGen/X86/pr34653.ll and CodeGen/WebAssembly/offset.ll since they can now use aligned loads.
Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D78999
show more ...
|
#
e13c141a |
| 28-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[SelectionDAGBuilder] Use CallBase::isInlineAsm in a couple places. NFC
These lines were just changed from using CallBase::getCalledValue to getCallledOperand. Go aheand change them to isInlineAsm.
|
#
a58b62b4 |
| 28-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
This method has been commented as deprecated for a while. Remove it and replace all uses with the equivalent getCalledOpe
[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
This method has been commented as deprecated for a while. Remove it and replace all uses with the equivalent getCalledOperand().
I also made a few cleanups in here. For example, to removes use of getElementType on a pointer when we could just use getFunctionType from the call.
Differential Revision: https://reviews.llvm.org/D78882
show more ...
|
#
096b25a8 |
| 27-Apr-2020 |
David Sherwood <david.sherwood@arm.com> |
[CodeGen] Use SPLAT_VECTOR for zeroinitialiser with scalable types
Summary: When generating code for the LLVM IR zeroinitialiser operation, if the vector type is scalable we should be using SPLAT_VE
[CodeGen] Use SPLAT_VECTOR for zeroinitialiser with scalable types
Summary: When generating code for the LLVM IR zeroinitialiser operation, if the vector type is scalable we should be using SPLAT_VECTOR instead of BUILD_VECTOR.
Differential Revision: https://reviews.llvm.org/D78636
show more ...
|
#
bbcfce4b |
| 23-Apr-2020 |
Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> |
Use FrameIndexTy for stack protector
Using getValueType() is not correct for architectures extended with CHERI since we need a pointer type and not the value that is loaded. While stack protector is
Use FrameIndexTy for stack protector
Using getValueType() is not correct for architectures extended with CHERI since we need a pointer type and not the value that is loaded. While stack protector is useless when you have CHERI (since CHERI provides much stronger security guarantees), we still have a test to check that we can generate correct code for checks. Merging b281138a1b67ca4405b77d774adc3de72742e7a2 into our tree broke this test. Fix by using TLI.getFrameIndexTy().
Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D77785
show more ...
|
#
05a11974 |
| 22-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[CallSite removal] Remove unneeded includes of CallSite.h. NFC
|
#
c858debe |
| 17-Apr-2020 |
Christopher Tetreault <ctetreau@quicinc.com> |
Remove asserting getters from base Type
Summary: Remove asserting vector getters from Type in preparation for the VectorType refactor. The existence of these functions complicates the refactor while
Remove asserting getters from base Type
Summary: Remove asserting vector getters from Type in preparation for the VectorType refactor. The existence of these functions complicates the refactor while adding little value.
Reviewers: dexonsmith, sdesmalen, efriedma
Reviewed By: efriedma
Subscribers: cfe-commits, hiraditya, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D77278
show more ...
|
#
944cc5e0 |
| 17-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[SelectionDAGBuilder][CGP][X86] Move some of SDB's gather/scatter uniform base handling to CGP.
I've always found the "findValue" a little odd and inconsistent with other things in SDB.
This simplf
[SelectionDAGBuilder][CGP][X86] Move some of SDB's gather/scatter uniform base handling to CGP.
I've always found the "findValue" a little odd and inconsistent with other things in SDB.
This simplfifies the code in SDB to just handle a splat constant address or a 2 operand GEP in the same BB. This removes the need for "findValue" since the operands to the GEP are guaranteed to be available. The splat constant handling is new, but was needed to avoid regressions due to constant folding combining GEPs created in CGP.
CGP is now responsible for canonicalizing gather/scatters into this form. The pattern I'm using for scalarizing, a scalar GEP followed by a GEP with an all zeroes index, seems to be subject to constant folding that the insertelement+shufflevector was not.
Differential Revision: https://reviews.llvm.org/D76947
show more ...
|
#
7c10541e |
| 07-Apr-2020 |
Eli Friedman <efriedma@quicinc.com> |
[SelectionDAG] Fix usage of Align constructing MachineMemOperands.
The "Align" passed into getMachineMemOperand etc. is the alignment of the MachinePointerInfo, not the alignment of the memory opera
[SelectionDAG] Fix usage of Align constructing MachineMemOperands.
The "Align" passed into getMachineMemOperand etc. is the alignment of the MachinePointerInfo, not the alignment of the memory operation. (getAlign() on a MachineMemOperand automatically reduces the alignment to account for this.)
We were passing on wrong (overconservative) alignment in a bunch of places. Fix a bunch of these, mostly in legalization. And while I'm here, switch to the new Align APIs.
The test changes are all scheduling changes: the biggest effect of preserving large alignments is that it improves alias analysis, so the scheduler has more freedom.
(I was originally just trying to do a minor cleanup in SelectionDAGBuilder, but I accidentally went deeper down the rabbit hole.)
Differential Revision: https://reviews.llvm.org/D77687
show more ...
|
#
d790bd39 |
| 15-Apr-2020 |
Benjamin Kramer <benny.kra@googlemail.com> |
Unbreak the build
|
#
d85b3877 |
| 25-Mar-2020 |
Victor Campos <victor.campos@arm.com> |
[CodeGen][ARM] Error when writing to specific reserved registers in inline asm
Summary: No error or warning is emitted when specific reserved registers are written to in inline assembly. Therefore,
[CodeGen][ARM] Error when writing to specific reserved registers in inline asm
Summary: No error or warning is emitted when specific reserved registers are written to in inline assembly. Therefore, writes to the program counter or to the frame pointer, for instance, were permitted, which could have led to undesirable behaviour.
Example: int foo() { register int a __asm__("r7"); // r7 = frame-pointer in M-class ARM __asm__ __volatile__("mov %0, r1" : "=r"(a) : : ); return a; }
In contrast, GCC issues an error in the same scenario.
This patch detects writes to specific reserved registers in inline assembly for ARM and emits an error in such case. The detection works for output and input operands. Clobber operands are not handled here: they are already covered at a later point in AsmPrinter::emitInlineAsm(const MachineInstr *MI). The registers covered are: program counter, frame pointer and base pointer.
This is ARM only. Therefore the implementation of other targets' counterparts remain open to do.
Reviewers: efriedma
Reviewed By: efriedma
Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76848
show more ...
|
#
30430938 |
| 14-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[CallSite removal][CodeGen] Replace ImmutableCallSite with CallBase in isInTailCallPosition.
|
#
113f37a1 |
| 13-Apr-2020 |
Craig Topper <craig.topper@intel.com> |
[CallSite removal][TargetLowering] Replace ImmutableCallSite with CallBase
Differential Revision: https://reviews.llvm.org/D77995
|
#
95192f54 |
| 12-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[CallSite removal][TargetLowering] Use CallBase instead of CallSite in TargetLowering::ParseConstraints interface.
Differential Revision: https://reviews.llvm.org/D77929
|
#
806763ef |
| 11-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[CallSite removal][SelectionDAGBuilder] Use CallBase instead of ImmutableCallSite in visitPatchpoint.
Differential Revision: https://reviews.llvm.org/D77932
|
#
f49f6cf9 |
| 11-Apr-2020 |
Craig Topper <craig.topper@gmail.com> |
[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.
I only left it at the interface to ParseConstraints since that needs updates to other callers in different fil
[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.
I only left it at the interface to ParseConstraints since that needs updates to other callers in different files. I'll do that as a follow up.
Differential Revision: https://reviews.llvm.org/D77892
show more ...
|
#
889f6606 |
| 10-Apr-2020 |
Christopher Tetreault <ctetreau@quicinc.com> |
Clean up usages of asserting vector getters in Type
Summary: Remove usages of asserting vector getters in Type in preparation for the VectorType refactor. The existence of these functions complicate
Clean up usages of asserting vector getters in Type
Summary: Remove usages of asserting vector getters in Type in preparation for the VectorType refactor. The existence of these functions complicates the refactor while adding little value.
Reviewers: stoklund, sdesmalen, efriedma
Reviewed By: sdesmalen
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77272
show more ...
|
#
586769cc |
| 08-Apr-2020 |
Matt Arsenault <Matthew.Arsenault@amd.com> |
DAG: Use Register
|