Skip to content

Commit

Permalink
Merged main:163c223161b8 into amd-gfx:26ab039577cd
Browse files Browse the repository at this point in the history
Local branch amd-gfx 26ab039 Merged main:4167a0259ec3 into amd-gfx:f23b536b3a0c
Remote branch main 163c223 [Debuginfo] [CSInfo] Do not create CSInfo for undef arguments
  • Loading branch information
Sw authored and Sw committed Dec 9, 2020
2 parents 26ab039 + 163c223 commit b0317bc
Show file tree
Hide file tree
Showing 101 changed files with 1,564 additions and 366 deletions.
46 changes: 23 additions & 23 deletions flang/include/flang/Optimizer/Dialect/FIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class fir_AllocatableOp<string mnemonic, list<OpTrait> traits = []> :
bool hasLenParams() { return bool{getAttr(lenpName())}; }

unsigned numLenParams() {
if (auto val = getAttrOfType<mlir::IntegerAttr>(lenpName()))
if (auto val = (*this)->getAttrOfType<mlir::IntegerAttr>(lenpName()))
return val.getInt();
return 0;
}
Expand All @@ -291,7 +291,7 @@ class fir_AllocatableOp<string mnemonic, list<OpTrait> traits = []> :

/// Get the input type of the allocation
mlir::Type getInType() {
return getAttrOfType<mlir::TypeAttr>(inType()).getValue();
return (*this)->getAttrOfType<mlir::TypeAttr>(inType()).getValue();
}
}];

Expand Down Expand Up @@ -567,7 +567,7 @@ class fir_SwitchTerminatorOp<string mnemonic, list<OpTrait> traits = []> :

// The number of destination conditions that may be tested
unsigned getNumConditions() {
return getAttrOfType<mlir::ArrayAttr>(getCasesAttr()).size();
return (*this)->getAttrOfType<mlir::ArrayAttr>(getCasesAttr()).size();
}

// The selector is the value being tested to determine the destination
Expand All @@ -577,7 +577,7 @@ class fir_SwitchTerminatorOp<string mnemonic, list<OpTrait> traits = []> :
}

// The number of blocks that may be branched to
unsigned getNumDest() { return getOperation()->getNumSuccessors(); }
unsigned getNumDest() { return (*this)->getNumSuccessors(); }

llvm::Optional<mlir::OperandRange> getCompareOperands(unsigned cond);
llvm::Optional<llvm::ArrayRef<mlir::Value>> getCompareOperands(
Expand Down Expand Up @@ -1561,11 +1561,11 @@ def fir_CoordinateOp : fir_Op<"coordinate_of", [NoSideEffect]> {
let parser = "return parseCoordinateOp(parser, result);";

let printer = [{
p << getOperationName() << ' ' << getOperation()->getOperands();
p << getOperationName() << ' ' << (*this)->getOperands();
p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{baseType()});
p << " : ";
p.printFunctionalType(getOperation()->getOperandTypes(),
getOperation()->getResultTypes());
p.printFunctionalType((*this)->getOperandTypes(),
(*this)->getResultTypes());
}];

let verifier = [{
Expand Down Expand Up @@ -1940,9 +1940,9 @@ def fir_LoopOp : region_Op<"do_loop",
return getOperands().drop_front(getNumControlOperands());
}

void setLowerBound(Value bound) { getOperation()->setOperand(0, bound); }
void setUpperBound(Value bound) { getOperation()->setOperand(1, bound); }
void setStep(Value step) { getOperation()->setOperand(2, step); }
void setLowerBound(Value bound) { (*this)->setOperand(0, bound); }
void setUpperBound(Value bound) { (*this)->setOperand(1, bound); }
void setStep(Value step) { (*this)->setOperand(2, step); }

/// Number of region arguments for loop-carried values
unsigned getNumRegionIterArgs() {
Expand All @@ -1952,18 +1952,18 @@ def fir_LoopOp : region_Op<"do_loop",
unsigned getNumControlOperands() { return 3; }
/// Does the operation hold operands for loop-carried values
bool hasIterOperands() {
return getOperation()->getNumOperands() > getNumControlOperands();
return (*this)->getNumOperands() > getNumControlOperands();
}
/// Get Number of loop-carried values
unsigned getNumIterOperands() {
return getOperation()->getNumOperands() - getNumControlOperands();
return (*this)->getNumOperands() - getNumControlOperands();
}

/// Get the body of the loop
mlir::Block *getBody() { return &region().front(); }

void setUnordered() {
getOperation()->setAttr(unorderedAttrName(),
(*this)->setAttr(unorderedAttrName(),
mlir::UnitAttr::get(getContext()));
}
}];
Expand Down Expand Up @@ -2062,9 +2062,9 @@ def fir_IterWhileOp : region_Op<"iterate_while",
return getOperands().drop_front(getNumControlOperands());
}

void setLowerBound(Value bound) { getOperation()->setOperand(0, bound); }
void setUpperBound(Value bound) { getOperation()->setOperand(1, bound); }
void setStep(mlir::Value step) { getOperation()->setOperand(2, step); }
void setLowerBound(Value bound) { (*this)->setOperand(0, bound); }
void setUpperBound(Value bound) { (*this)->setOperand(1, bound); }
void setStep(mlir::Value step) { (*this)->setOperand(2, step); }

/// Number of region arguments for loop-carried values
unsigned getNumRegionIterArgs() {
Expand All @@ -2074,11 +2074,11 @@ def fir_IterWhileOp : region_Op<"iterate_while",
unsigned getNumControlOperands() { return 3; }
/// Does the operation hold operands for loop-carried values
bool hasIterOperands() {
return getOperation()->getNumOperands() > getNumControlOperands();
return (*this)->getNumOperands() > getNumControlOperands();
}
/// Get Number of loop-carried values
unsigned getNumIterOperands() {
return getOperation()->getNumOperands() - getNumControlOperands();
return (*this)->getNumOperands() - getNumControlOperands();
}
}];
}
Expand Down Expand Up @@ -2705,7 +2705,7 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> {
p << " : ";
p.printType(getType());
if (hasInitializationBody())
p.printRegion(getOperation()->getRegion(0), /*printEntryBlockArgs=*/false,
p.printRegion((*this)->getRegion(0), /*printEntryBlockArgs=*/false,
/*printBlockTerminators=*/true);
}];

Expand Down Expand Up @@ -2754,7 +2754,7 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> {
void appendInitialValue(mlir::Operation *op);

/// A GlobalOp has one region.
mlir::Region &getRegion() { return getOperation()->getRegion(0); }
mlir::Region &getRegion() { return (*this)->getRegion(0); }

/// A GlobalOp has one block.
mlir::Block &getBlock() { return getRegion().front(); }
Expand All @@ -2763,7 +2763,7 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> {
static mlir::ParseResult verifyValidLinkage(StringRef linkage);

bool hasInitializationBody() {
return (getOperation()->getNumRegions() == 1) && !getRegion().empty() &&
return ((*this)->getNumRegions() == 1) && !getRegion().empty() &&
!isa<fir::FirEndOp>(getBlock().front());
}

Expand Down Expand Up @@ -2869,7 +2869,7 @@ def fir_DispatchTableOp : fir_Op<"dispatch_table",
mlir::SymbolTable::getSymbolAttrName()).getValue();
p << getOperationName() << " @" << tableName;

Region &body = getOperation()->getRegion(0);
Region &body = (*this)->getRegion(0);
if (!body.empty())
p.printRegion(body, /*printEntryBlockArgs=*/false,
/*printBlockTerminators=*/false);
Expand Down Expand Up @@ -2900,7 +2900,7 @@ def fir_DispatchTableOp : fir_Op<"dispatch_table",
void appendTableEntry(mlir::Operation *op);

mlir::Region &getRegion() {
return this->getOperation()->getRegion(0);
return (*this)->getRegion(0);
}

mlir::Block &getBlock() {
Expand Down
75 changes: 75 additions & 0 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16095,6 +16095,81 @@ Arguments:
""""""""""
The argument to this intrinsic must be a vector of floating-point values.

'``llvm.experimental.vector.insert``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""
This is an overloaded intrinsic. You can use ``llvm.experimental.vector.insert``
to insert a fixed-width vector into a scalable vector, but not the other way
around.

::

declare <vscale x 4 x float> @llvm.experimental.vector.insert.v4f32(<vscale x 4 x float> %vec, <4 x float> %subvec, i64 %idx)
declare <vscale x 2 x double> @llvm.experimental.vector.insert.v2f64(<vscale x 2 x double> %vec, <2 x double> %subvec, i64 %idx)

Overview:
"""""""""

The '``llvm.experimental.vector.insert.*``' intrinsics insert a vector into another vector
starting from a given index. The return type matches the type of the vector we
insert into. Conceptually, this can be used to build a scalable vector out of
non-scalable vectors.

Arguments:
""""""""""

The ``vec`` is the vector which ``subvec`` will be inserted into.
The ``subvec`` is the vector that will be inserted.

``idx`` represents the starting element number at which ``subvec`` will be
inserted. ``idx`` must be a constant multiple of ``subvec``'s known minimum
vector length. If ``subvec`` is a scalable vector, ``idx`` is first scaled by
the runtime scaling factor of ``subvec``. The elements of ``vec`` starting at
``idx`` are overwritten with ``subvec``. Elements ``idx`` through (``idx`` +
num_elements(``subvec``) - 1) must be valid ``vec`` indices. If this condition
cannot be determined statically but is false at runtime, then the result vector
is undefined.


'``llvm.experimental.vector.extract``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""
This is an overloaded intrinsic. You can use
``llvm.experimental.vector.extract`` to extract a fixed-width vector from a
scalable vector, but not the other way around.

::

declare <4 x float> @llvm.experimental.vector.extract.v4f32(<vscale x 4 x float> %vec, i64 %idx)
declare <2 x double> @llvm.experimental.vector.extract.v2f64(<vscale x 2 x double> %vec, i64 %idx)

Overview:
"""""""""

The '``llvm.experimental.vector.extract.*``' intrinsics extract a vector from
within another vector starting from a given index. The return type must be
explicitly specified. Conceptually, this can be used to decompose a scalable
vector into non-scalable parts.

Arguments:
""""""""""

The ``vec`` is the vector from which we will extract a subvector.

The ``idx`` specifies the starting element number within ``vec`` from which a
subvector is extracted. ``idx`` must be a constant multiple of the known-minimum
vector length of the result type. If the result type is a scalable vector,
``idx`` is first scaled by the result type's runtime scaling factor. Elements
``idx`` through (``idx`` + num_elements(result_type) - 1) must be valid vector
indices. If this condition cannot be determined statically but is false at
runtime, then the result vector is undefined. The ``idx`` parameter must be a
vector index constant type (for most targets this will be an integer pointer
type).

Matrix Intrinsics
-----------------

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ class SelectionDAG {
ISD::MemIndexedMode AM);
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl,
ArrayRef<SDValue> Ops, MachineMemOperand *MMO,
ISD::MemIndexType IndexType);
ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy);
SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl,
ArrayRef<SDValue> Ops, MachineMemOperand *MMO,
ISD::MemIndexType IndexType,
Expand Down
11 changes: 9 additions & 2 deletions llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ BEGIN_TWO_BYTE_PACK()
class LoadSDNodeBitfields {
friend class LoadSDNode;
friend class MaskedLoadSDNode;
friend class MaskedGatherSDNode;

uint16_t : NumLSBaseSDNodeBits;

Expand Down Expand Up @@ -2451,12 +2452,18 @@ class MaskedGatherSDNode : public MaskedGatherScatterSDNode {

MaskedGatherSDNode(unsigned Order, const DebugLoc &dl, SDVTList VTs,
EVT MemVT, MachineMemOperand *MMO,
ISD::MemIndexType IndexType)
ISD::MemIndexType IndexType, ISD::LoadExtType ETy)
: MaskedGatherScatterSDNode(ISD::MGATHER, Order, dl, VTs, MemVT, MMO,
IndexType) {}
IndexType) {
LoadSDNodeBits.ExtTy = ETy;
}

const SDValue &getPassThru() const { return getOperand(1); }

ISD::LoadExtType getExtensionType() const {
return ISD::LoadExtType(LoadSDNodeBits.ExtTy);
}

static bool classof(const SDNode *N) {
return N->getOpcode() == ISD::MGATHER;
}
Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/IR/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ class IRBuilderBase {
Type *ResultType,
const Twine &Name = "");

/// Create a call to llvm.vscale, multiplied by \p Scaling. The type of VScale
/// will be the same type as that of \p Scaling.
Value *CreateVScale(Constant *Scaling, const Twine &Name = "");

/// Create a call to intrinsic \p ID with 1 operand which is mangled on its
/// type.
CallInst *CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V,
Expand Down
9 changes: 9 additions & 0 deletions llvm/include/llvm/IR/Intrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,15 @@ def int_preserve_struct_access_index : DefaultAttrsIntrinsic<[llvm_anyptr_ty],
//===---------- Intrinsics to query properties of scalable vectors --------===//
def int_vscale : DefaultAttrsIntrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;

//===---------- Intrinsics to perform subvector insertion/extraction ------===//
def int_experimental_vector_insert : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
[LLVMMatchType<0>, llvm_anyvector_ty, llvm_i64_ty],
[IntrNoMem, ImmArg<ArgIndex<2>>]>;

def int_experimental_vector_extract : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
[llvm_anyvector_ty, llvm_i64_ty],
[IntrNoMem, ImmArg<ArgIndex<1>>]>;

//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
Expand Down
10 changes: 10 additions & 0 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,16 @@ static void collectCallSiteParameters(const MachineInstr *CallMI,
(void)InsertedReg;
}

// Do not emit CSInfo for undef forwarding registers.
for (auto &MO : CallMI->uses()) {
if (!MO.isReg() || !MO.isUndef())
continue;
auto It = ForwardedRegWorklist.find(MO.getReg());
if (It == ForwardedRegWorklist.end())
continue;
ForwardedRegWorklist.erase(It);
}

// We erase, from the ForwardedRegWorklist, those forwarding registers for
// which we successfully describe a loaded value (by using
// the describeLoadedValue()). For those remaining arguments in the working
Expand Down
Loading

0 comments on commit b0317bc

Please sign in to comment.