[llvm-branch-commits] [mlir] 6367306 - [mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder
Author: Benjamin Kramer Date: 2021-01-25T11:48:58+01:00 New Revision: 6367306a1be3adf7125c0b8b8f87209b8fc836f7 URL: https://github.com/llvm/llvm-project/commit/6367306a1be3adf7125c0b8b8f87209b8fc836f7 DIFF: https://github.com/llvm/llvm-project/commit/6367306a1be3adf7125c0b8b8f87209b8fc836f7.diff LOG: [mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder This is both cleaner and less prone to creating a mess out of overload resolution. Added: Modified: mlir/include/mlir/IR/ImplicitLocOpBuilder.h Removed: diff --git a/mlir/include/mlir/IR/ImplicitLocOpBuilder.h b/mlir/include/mlir/IR/ImplicitLocOpBuilder.h index ff85f2b5a382..862be32e6208 100644 --- a/mlir/include/mlir/IR/ImplicitLocOpBuilder.h +++ b/mlir/include/mlir/IR/ImplicitLocOpBuilder.h @@ -22,20 +22,11 @@ namespace mlir { /// as OpBuilder. class ImplicitLocOpBuilder : public mlir::OpBuilder { public: - /// Create an ImplicitLocOpBuilder using the insertion point and listener from - /// an existing OpBuilder. - ImplicitLocOpBuilder(Location loc, const OpBuilder &builder) - : OpBuilder(builder), curLoc(loc) {} - /// OpBuilder has a bunch of convenience constructors - we support them all /// with the additional Location. - template - ImplicitLocOpBuilder(Location loc, T &&operand, Listener *listener = nullptr) - : OpBuilder(std::forward(operand), listener), curLoc(loc) {} - - ImplicitLocOpBuilder(Location loc, Block *block, Block::iterator insertPoint, - Listener *listener = nullptr) - : OpBuilder(block, insertPoint, listener), curLoc(loc) {} + template + ImplicitLocOpBuilder(Location loc, T &&...operands) + : OpBuilder(std::forward(operands)...), curLoc(loc) {} /// Create a builder and set the insertion point to before the first operation /// in the block but still inside the block. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8ed332f - [LSV] Vectorize loads of vectors by turning it into a larger vector
Author: Benjamin Kramer Date: 2022-01-13T13:12:50+01:00 New Revision: 8ed332fccca3bc62a654ce71fa0f3301aaa08608 URL: https://github.com/llvm/llvm-project/commit/8ed332fccca3bc62a654ce71fa0f3301aaa08608 DIFF: https://github.com/llvm/llvm-project/commit/8ed332fccca3bc62a654ce71fa0f3301aaa08608.diff LOG: [LSV] Vectorize loads of vectors by turning it into a larger vector Added: Modified: llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp Removed: diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index d2e0d1d474b0..d76a51ee09e3 100644 --- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -854,13 +854,6 @@ Vectorizer::collectInstructions(BasicBlock *BB) { (VecTy && TTI.getLoadVectorFactor(VF, TySize, TySize / 8, VecTy) == 0)) continue; - // Make sure all the users of a vector are constant-index extracts. - if (isa(Ty) && !llvm::all_of(LI->users(), [](const User *U) { -const ExtractElementInst *EEI = dyn_cast(U); -return EEI && isa(EEI->getOperand(1)); - })) -continue; - // Save the load locations. const ChainID ID = getChainID(Ptr); LoadRefs[ID].push_back(LI); @@ -901,12 +894,6 @@ Vectorizer::collectInstructions(BasicBlock *BB) { (VecTy && TTI.getStoreVectorFactor(VF, TySize, TySize / 8, VecTy) == 0)) continue; - if (isa(Ty) && !llvm::all_of(SI->users(), [](const User *U) { -const ExtractElementInst *EEI = dyn_cast(U); -return EEI && isa(EEI->getOperand(1)); - })) -continue; - // Save store location. const ChainID ID = getChainID(Ptr); StoreRefs[ID].push_back(SI); @@ -1290,52 +1277,29 @@ bool Vectorizer::vectorizeLoadChain( Builder.CreateAlignedLoad(VecTy, Bitcast, MaybeAlign(Alignment)); propagateMetadata(LI, Chain); - if (VecLoadTy) { -SmallVector InstrsToErase; - -unsigned VecWidth = VecLoadTy->getNumElements(); -for (unsigned I = 0, E = Chain.size(); I != E; ++I) { - for (auto Use : Chain[I]->users()) { -// All users of vector loads are ExtractElement instructions with -// constant indices, otherwise we would have bailed before now. -Instruction *UI = cast(Use); -unsigned Idx = cast(UI->getOperand(1))->getZExtValue(); -unsigned NewIdx = Idx + I * VecWidth; -Value *V = Builder.CreateExtractElement(LI, Builder.getInt32(NewIdx), -UI->getName()); -if (V->getType() != UI->getType()) - V = Builder.CreateBitCast(V, UI->getType()); - -// Replace the old instruction. -UI->replaceAllUsesWith(V); -InstrsToErase.push_back(UI); - } + auto Extract = [&](unsigned I, Value *CV) { +if (VecLoadTy) { + unsigned VecWidth = VecLoadTy->getNumElements(); + auto Mask = + llvm::to_vector<8>(llvm::seq(I * VecWidth, I * VecWidth + VecWidth)); + return Builder.CreateShuffleVector(LI, LI, Mask, CV->getName()); } - -// Bitcast might not be an Instruction, if the value being loaded is a -// constant. In that case, no need to reorder anything. -if (Instruction *BitcastInst = dyn_cast(Bitcast)) - reorder(BitcastInst); - -for (auto I : InstrsToErase) - I->eraseFromParent(); - } else { -for (unsigned I = 0, E = Chain.size(); I != E; ++I) { - Value *CV = Chain[I]; - Value *V = - Builder.CreateExtractElement(LI, Builder.getInt32(I), CV->getName()); - if (V->getType() != CV->getType()) { -V = Builder.CreateBitOrPointerCast(V, CV->getType()); - } - - // Replace the old instruction. - CV->replaceAllUsesWith(V); +return Builder.CreateExtractElement(LI, Builder.getInt32(I), CV->getName()); + }; + for (unsigned I = 0, E = Chain.size(); I != E; ++I) { +Value *CV = Chain[I]; +Value *V = Extract(I, CV); +if (V->getType() != CV->getType()) { + V = Builder.CreateBitOrPointerCast(V, CV->getType()); } -if (Instruction *BitcastInst = dyn_cast(Bitcast)) - reorder(BitcastInst); +// Replace the old instruction. +CV->replaceAllUsesWith(V); } + if (Instruction *BitcastInst = dyn_cast(Bitcast)) +reorder(BitcastInst); + eraseInstructions(Chain); ++NumVectorInstructions; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra-branch] r277588 - Expand the clang-include-fixer relnotes a bit.
Author: d0k Date: Wed Aug 3 06:59:03 2016 New Revision: 277588 URL: http://llvm.org/viewvc/llvm-project?rev=277588&view=rev Log: Expand the clang-include-fixer relnotes a bit. Modified: clang-tools-extra/branches/release_39/docs/ReleaseNotes.rst Modified: clang-tools-extra/branches/release_39/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_39/docs/ReleaseNotes.rst?rev=277588&r1=277587&r2=277588&view=diff == --- clang-tools-extra/branches/release_39/docs/ReleaseNotes.rst (original) +++ clang-tools-extra/branches/release_39/docs/ReleaseNotes.rst Wed Aug 3 06:59:03 2016 @@ -47,6 +47,13 @@ Major New Features - :program:`clang-include-fixer`, a tool that provides an automated way of adding ``#include`` directives for missing symbols in one translation unit. + It aims to provide automated insertion of missing ``#includes`` with a single + button press in an editor. Integration with Vim and a tool to generate the + symbol index used by the tool are also part of this release. See the + `include-fixer documentation`_ for more information. + +.. _include-fixer documentation: http://clang.llvm.org/extra/include-fixer.html + Improvements to clang-query --- ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-tag] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: cfe/tags/google/stable/2018-01-11/ - copied from r321963, cfe/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: lldb/branches/google/stable/ - copied from r321963, lldb/trunk/ lldb/tags/google/stable/2018-01-11/ - copied from r321963, lldb/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra-branch] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: clang-tools-extra/branches/google/stable/ - copied from r321963, clang-tools-extra/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt-tag] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: compiler-rt/tags/google/stable/2018-01-11/ - copied from r321963, compiler-rt/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-tag] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: llvm/tags/google/stable/2018-01-11/ - copied from r321963, llvm/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-branch] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: llvm/branches/google/stable/ - copied from r321963, llvm/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: cfe/branches/google/stable/ - copied from r321963, cfe/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra-tag] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: clang-tools-extra/tags/google/stable/2018-01-11/ - copied from r321963, clang-tools-extra/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt-branch] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: compiler-rt/branches/google/stable/ - copied from r321963, compiler-rt/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [polly] r322302 - Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963
Author: d0k Date: Thu Jan 11 10:20:17 2018 New Revision: 322302 URL: http://llvm.org/viewvc/llvm-project?rev=322302&view=rev Log: Creating branches/google/stable and tags/google/stable/2018-01-11 from r321963 Added: polly/branches/google/stable/ - copied from r321963, polly/trunk/ polly/tags/google/stable/2018-01-11/ - copied from r321963, polly/trunk/ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 9549abc - Remove stray debug-only from test
Author: Benjamin Kramer Date: 2020-11-26T15:37:18+01:00 New Revision: 9549abcbb8245aad271eb496a751cb65b2f7dc0f URL: https://github.com/llvm/llvm-project/commit/9549abcbb8245aad271eb496a751cb65b2f7dc0f DIFF: https://github.com/llvm/llvm-project/commit/9549abcbb8245aad271eb496a751cb65b2f7dc0f.diff LOG: Remove stray debug-only from test Added: Modified: mlir/test/Dialect/Standard/func-bufferize-partial.mlir Removed: diff --git a/mlir/test/Dialect/Standard/func-bufferize-partial.mlir b/mlir/test/Dialect/Standard/func-bufferize-partial.mlir index 2afa5327e572..43ea4591e4e3 100644 --- a/mlir/test/Dialect/Standard/func-bufferize-partial.mlir +++ b/mlir/test/Dialect/Standard/func-bufferize-partial.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -func-bufferize -split-input-file -verify-diagnostics --debug-only=dialect-conversion | FileCheck %s +// RUN: mlir-opt %s -func-bufferize -split-input-file -verify-diagnostics | FileCheck %s // CHECK-LABEL: func @block_arguments( // CHECK-SAME:%[[ARG:.*]]: memref) -> memref { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 107e92d - [DAG] Remove unused variable. NFC.
Author: Benjamin Kramer Date: 2020-12-01T16:29:02+01:00 New Revision: 107e92dff8ca3c27478baccc50e183d81da7ea17 URL: https://github.com/llvm/llvm-project/commit/107e92dff8ca3c27478baccc50e183d81da7ea17 DIFF: https://github.com/llvm/llvm-project/commit/107e92dff8ca3c27478baccc50e183d81da7ea17.diff LOG: [DAG] Remove unused variable. NFC. Added: Modified: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Removed: diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1684ec90f676..9505204732c8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -9758,7 +9758,7 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) { } if (Other && Other.getNumOperands() == 2 && Other.getOperand(0) == LHS) { -SDValue CondLHS = LHS, CondRHS = RHS; +SDValue CondRHS = RHS; SDValue OpLHS = Other.getOperand(0), OpRHS = Other.getOperand(1); // Look for a general sub with unsigned saturation first. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 2a136a7 - [X86] Autodetect znver3
Author: Benjamin Kramer Date: 2020-12-05T19:08:20+01:00 New Revision: 2a136a7a9c68e4818b28bea6051b78a8181ba78e URL: https://github.com/llvm/llvm-project/commit/2a136a7a9c68e4818b28bea6051b78a8181ba78e DIFF: https://github.com/llvm/llvm-project/commit/2a136a7a9c68e4818b28bea6051b78a8181ba78e.diff LOG: [X86] Autodetect znver3 Added: Modified: clang/test/CodeGen/target-builtin-noerror.c compiler-rt/lib/builtins/cpu_model.c llvm/include/llvm/Support/X86TargetParser.def llvm/lib/Support/Host.cpp Removed: diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index 50967c6657cd..808f3a03431b 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -128,4 +128,5 @@ void verifycpustrings() { (void)__builtin_cpu_is("westmere"); (void)__builtin_cpu_is("znver1"); (void)__builtin_cpu_is("znver2"); + (void)__builtin_cpu_is("znver3"); } diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c index 05ef8492384f..51bedd98c3d3 100644 --- a/compiler-rt/lib/builtins/cpu_model.c +++ b/compiler-rt/lib/builtins/cpu_model.c @@ -68,6 +68,7 @@ enum ProcessorTypes { INTEL_GOLDMONT, INTEL_GOLDMONT_PLUS, INTEL_TREMONT, + AMDFAM19H, CPU_TYPE_MAX }; @@ -97,6 +98,7 @@ enum ProcessorSubtypes { INTEL_COREI7_COOPERLAKE, INTEL_COREI7_SAPPHIRERAPIDS, INTEL_COREI7_ALDERLAKE, + AMDFAM19H_ZNVER3, CPU_SUBTYPE_MAX }; @@ -550,6 +552,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: +CPU = "znver3"; +*Type = AMDFAM19H; +if (Model <= 0x0f) { + *Subtype = AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 +} +break; default: break; // Unknown AMD CPU. } diff --git a/llvm/include/llvm/Support/X86TargetParser.def b/llvm/include/llvm/Support/X86TargetParser.def index c0fe76dfdd64..ec19ce4e7cdd 100644 --- a/llvm/include/llvm/Support/X86TargetParser.def +++ b/llvm/include/llvm/Support/X86TargetParser.def @@ -44,6 +44,7 @@ X86_CPU_TYPE(INTEL_KNM, "knm") X86_CPU_TYPE(INTEL_GOLDMONT, "goldmont") X86_CPU_TYPE(INTEL_GOLDMONT_PLUS, "goldmont-plus") X86_CPU_TYPE(INTEL_TREMONT, "tremont") +X86_CPU_TYPE(AMDFAM19H, "amdfam19h") // Alternate names supported by __builtin_cpu_is and target multiversioning. X86_CPU_TYPE_ALIAS(INTEL_BONNELL,"atom") @@ -86,6 +87,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_TIGERLAKE, "tigerlake") X86_CPU_SUBTYPE(INTEL_COREI7_COOPERLAKE, "cooperlake") X86_CPU_SUBTYPE(INTEL_COREI7_SAPPHIRERAPIDS, "sapphirerapids") X86_CPU_SUBTYPE(INTEL_COREI7_ALDERLAKE, "alderlake") +X86_CPU_SUBTYPE(AMDFAM19H_ZNVER3,"znver3") #undef X86_CPU_SUBTYPE diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 4fb93928ff15..b179c8334a2b 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -964,6 +964,14 @@ getAMDProcessorTypeAndSubtype(unsigned Family, unsigned Model, break; // 00h-0Fh: Zen1 } break; + case 25: +CPU = "znver3"; +*Type = X86::AMDFAM19H; +if (Model <= 0x0f) { + *Subtype = X86::AMDFAM19H_ZNVER3; + break; // 00h-0Fh: Zen3 +} +break; default: break; // Unknown AMD CPU. } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 5844bc5 - [mlir][Shape] Canonicalize assume_all with one input and tensor_cast of constant_shape
Author: Benjamin Kramer Date: 2020-12-08T17:07:24+01:00 New Revision: 5844bc540cafb4330e7625b83371f1dab90528c3 URL: https://github.com/llvm/llvm-project/commit/5844bc540cafb4330e7625b83371f1dab90528c3 DIFF: https://github.com/llvm/llvm-project/commit/5844bc540cafb4330e7625b83371f1dab90528c3.diff LOG: [mlir][Shape] Canonicalize assume_all with one input and tensor_cast of constant_shape This allows simplifying some more complicated shape expressions Differential Revision: https://reviews.llvm.org/D92843 Added: Modified: mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td mlir/lib/Dialect/Shape/IR/Shape.cpp mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td mlir/test/Dialect/Shape/canonicalize.mlir Removed: diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td index 52768e49001d..552de7e78f91 100644 --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td @@ -105,6 +105,7 @@ def Shape_ConstShapeOp : Shape_Op<"const_shape", [ConstantLike, NoSideEffect]> { let printer = [{ return ::print(p, *this); }]; let parser = [{ return ::parse$cppClass(parser, result); }]; let hasFolder = 1; + let hasCanonicalizer = 1; } def Shape_ConstSizeOp : Shape_Op<"const_size", [ @@ -630,6 +631,7 @@ def Shape_AssumingAllOp : Shape_Op<"assuming_all", [Commutative, NoSideEffect]> let assemblyFormat = "$inputs attr-dict"; let hasFolder = 1; + let hasCanonicalizer = 1; let verifier = [{ return ::verify(*this); }]; } diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp index fe57f7d7a52e..acb35b916f7e 100644 --- a/mlir/lib/Dialect/Shape/IR/Shape.cpp +++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp @@ -271,6 +271,12 @@ void AssumingOp::inlineRegionIntoParent(AssumingOp &op, //===--===// // AssumingAllOp //===--===// + +void AssumingAllOp::getCanonicalizationPatterns( +OwningRewritePatternList &patterns, MLIRContext *context) { + patterns.insert(context); +} + OpFoldResult AssumingAllOp::fold(ArrayRef operands) { // Iterate in reverse to first handle all constant operands. They are // guaranteed to be the tail of the inputs because this is commutative. @@ -394,6 +400,11 @@ static ParseResult parseConstShapeOp(OpAsmParser &parser, OpFoldResult ConstShapeOp::fold(ArrayRef) { return shapeAttr(); } +void ConstShapeOp::getCanonicalizationPatterns( +OwningRewritePatternList &patterns, MLIRContext *context) { + patterns.insert(context); +} + //===--===// // CstrBroadcastableOp //===--===// diff --git a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td index c57ad8c8d17c..43c670a8582e 100644 --- a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td +++ b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td @@ -1,4 +1,5 @@ include "mlir/Dialect/Shape/IR/ShapeOps.td" +include "mlir/Dialect/StandardOps/IR/Ops.td" def AllInputShapesEq : Constraint>; +def HasSingleElement : Constraint>; + // Canonicalization patterns. +def AssumingAllOneOp : Pat<(Shape_AssumingAllOp $args), + (replaceWithValue $args), + [(HasSingleElement $args)]>; + def CstrBroadcastableEqOps : Pat<(Shape_CstrBroadcastableOp:$op $x, $x), (Shape_ConstWitnessOp ConstBoolAttrTrue)>; @@ -23,3 +32,5 @@ def SizeToIndexToSizeCanonicalization : Pat< (Shape_IndexToSizeOp (Shape_SizeToIndexOp $arg)), (replaceWithValue $arg)>; +def TensorCastConstShape : Pat < + (TensorCastOp (Shape_ConstShapeOp:$c $ty)), (replaceWithValue $c)>; diff --git a/mlir/test/Dialect/Shape/canonicalize.mlir b/mlir/test/Dialect/Shape/canonicalize.mlir index 56a6ef74f54e..9cb01da75901 100644 --- a/mlir/test/Dialect/Shape/canonicalize.mlir +++ b/mlir/test/Dialect/Shape/canonicalize.mlir @@ -427,20 +427,23 @@ func @f() { // - -// assuming_all should not be removed if not all witnesses are statically passing. +// assuming_all should not be removed if more than one witness is not +// statically passing // // Additionally check that the attribute is moved to the end as this op is // commutative. // CHECK-LABEL: func @f func @f() { - // CHECK-NEXT: %[[UNKNOWN:.*]] = "test.source" - // CHECK-NEXT: shape.assuming_all %[[UNKNOWN]] + // CHECK-NEXT: %[[UNKNOWN1:.*]] = "test.source" + // CHECK-NEXT: %[[UNKNOWN2:.*]] = "test.source" + // CHECK-NEXT: shape.assuming_all %[[UNKNOWN1]], %[[UNKNOWN2]] // CHECK-NEXT: consume.witness // CHECK-NEXT: return %0 = shape.const_witness true %1 = "test.sourc
[llvm-branch-commits] [llvm] 10987e3 - Remove unused include. NFC.
Author: Benjamin Kramer Date: 2020-12-08T19:03:56+01:00 New Revision: 10987e30be7737855ac5bc4289b3abc052f7d403 URL: https://github.com/llvm/llvm-project/commit/10987e30be7737855ac5bc4289b3abc052f7d403 DIFF: https://github.com/llvm/llvm-project/commit/10987e30be7737855ac5bc4289b3abc052f7d403.diff LOG: Remove unused include. NFC. This is also a layering violation. Added: Modified: llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp Removed: diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp index 82c110a4b2ab..fb5ad3fb1c88 100644 --- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp @@ -15,7 +15,6 @@ #include "llvm/ADT/Twine.h" #include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5f18e2f - Move createScalarizeMaskedMemIntrinPass to Scalar.h
Author: Benjamin Kramer Date: 2020-12-08T19:08:09+01:00 New Revision: 5f18e2f31ecbda5ace100cd2925ef7a0cafe3c3b URL: https://github.com/llvm/llvm-project/commit/5f18e2f31ecbda5ace100cd2925ef7a0cafe3c3b DIFF: https://github.com/llvm/llvm-project/commit/5f18e2f31ecbda5ace100cd2925ef7a0cafe3c3b.diff LOG: Move createScalarizeMaskedMemIntrinPass to Scalar.h Added: Modified: llvm/include/llvm/CodeGen/Passes.h llvm/include/llvm/Transforms/Scalar.h llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index e3aa32bffb71..a74334e6200c 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -76,10 +76,6 @@ namespace llvm { /// matching during instruction selection. FunctionPass *createCodeGenPreparePass(); - /// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather - /// and scatter intrinsics with scalar code when target doesn't support them. - FunctionPass *createScalarizeMaskedMemIntrinPass(); - /// AtomicExpandID -- Lowers atomic operations in terms of either cmpxchg /// load-linked/store-conditional loops. extern char &AtomicExpandID; diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h index 68f678432471..2cebd89fdddb 100644 --- a/llvm/include/llvm/Transforms/Scalar.h +++ b/llvm/include/llvm/Transforms/Scalar.h @@ -545,6 +545,14 @@ Pass *createWarnMissedTransformationsPass(); // instruction in a function. // FunctionPass *createInstSimplifyLegacyPass(); + + +//===--===// +// +// createScalarizeMaskedMemIntrinPass - Replace masked load, store, gather +// and scatter intrinsics with scalar code when target doesn't support them. +// +FunctionPass *createScalarizeMaskedMemIntrinPass(); } // End llvm namespace #endif diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp index fb5ad3fb1c88..98d85f4f5844 100644 --- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp @@ -31,6 +31,7 @@ #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Casting.h" +#include "llvm/Transforms/Scalar.h" #include #include ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 1d00508 - [mlir][Shape] Make sure tensor_cast(constant_shape) folding uses the correct type
Author: Benjamin Kramer Date: 2020-12-10T10:49:25+01:00 New Revision: 1d00508c5bf0d43203e11765ce84cdd6cf257856 URL: https://github.com/llvm/llvm-project/commit/1d00508c5bf0d43203e11765ce84cdd6cf257856 DIFF: https://github.com/llvm/llvm-project/commit/1d00508c5bf0d43203e11765ce84cdd6cf257856.diff LOG: [mlir][Shape] Make sure tensor_cast(constant_shape) folding uses the correct type This is still subtle, but I think the test cases are sufficient to show that it works. Differential Revision: https://reviews.llvm.org/D92927 Added: Modified: mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td mlir/test/Dialect/Shape/canonicalize.mlir Removed: diff --git a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td index 43c670a8582e..4e6d062a232f 100644 --- a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td +++ b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td @@ -32,5 +32,7 @@ def SizeToIndexToSizeCanonicalization : Pat< (Shape_IndexToSizeOp (Shape_SizeToIndexOp $arg)), (replaceWithValue $arg)>; +// Fold tensor_cast(const_shape) to const_shape. This changes the type of +// const_shape to the destination type of the cast. def TensorCastConstShape : Pat < - (TensorCastOp (Shape_ConstShapeOp:$c $ty)), (replaceWithValue $c)>; + (TensorCastOp (Shape_ConstShapeOp $arg)), (Shape_ConstShapeOp $arg)>; diff --git a/mlir/test/Dialect/Shape/canonicalize.mlir b/mlir/test/Dialect/Shape/canonicalize.mlir index 9cb01da75901..aa43f515f753 100644 --- a/mlir/test/Dialect/Shape/canonicalize.mlir +++ b/mlir/test/Dialect/Shape/canonicalize.mlir @@ -872,13 +872,24 @@ func @fold_assuming_all_single_element(%arg: tensor) { // - -// Fold tensor_cast of a const_shape to const_shape -// CHECK-LABEL: @fold_tensor_cast_of_const_shape -func @fold_tensor_cast_of_const_shape(%arg: tensor) { +// Verify that tensor_cast folding uses the correct type +// CHECK-LABEL: @fold_tensor_cast_of_const_shape_returned +func @fold_tensor_cast_of_const_shape_returned(%arg: i1) -> tensor<1xindex> { + // CHECK: constant dense<2> : tensor<1xindex> // CHECK-NOT: tensor_cast %0 = shape.const_shape [2] : tensor %1 = tensor_cast %0 : tensor to tensor<1xindex> - %2 = shape.cstr_broadcastable %1, %0 : tensor<1xindex>, tensor - "consume.witness"(%2) : (!shape.witness) -> () - return + return %1 : tensor<1xindex> +} + +// - + +// Verify that tensor_cast folding uses the correct type +// CHECK-LABEL: @fold_tensor_cast_of_const_shape_returned_dynamic +func @fold_tensor_cast_of_const_shape_returned_dynamic(%arg: i1) -> tensor { + // CHECK: shape.const_shape [2] : tensor + // CHECK-NOT: tensor_cast + %0 = shape.const_shape [2] : tensor<1xindex> + %1 = tensor_cast %0 : tensor<1xindex> to tensor + return %1 : tensor } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] eeb713b - [Hexagon] Fold single-use variables into assert. NFCI.
Author: Benjamin Kramer Date: 2020-12-10T10:53:56+01:00 New Revision: eeb713bbe24207343c8666a3240265758cd4fabd URL: https://github.com/llvm/llvm-project/commit/eeb713bbe24207343c8666a3240265758cd4fabd DIFF: https://github.com/llvm/llvm-project/commit/eeb713bbe24207343c8666a3240265758cd4fabd.diff LOG: [Hexagon] Fold single-use variables into assert. NFCI. Silences unused variable warnings in Release builds. Added: Modified: llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp Removed: diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp index 1bfb4cef3eb6..8af1f6d15ad1 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp @@ -1088,8 +1088,7 @@ auto HexagonVectorCombine::vresize(IRBuilder<> &Builder, Value *Val, int NewSize, Value *Pad) const -> Value * { assert(isa(Val->getType())); auto *ValTy = cast(Val->getType()); - auto *PadTy = Pad->getType(); - assert(ValTy->getElementType() == PadTy); + assert(ValTy->getElementType() == Pad->getType()); int CurSize = ValTy->getElementCount().getFixedValue(); if (CurSize == NewSize) @@ -1173,7 +1172,6 @@ auto HexagonVectorCombine::createHvxIntrinsic(IRBuilder<> &Builder, int HwLen = HST.getVectorLength(); Type *BoolTy = Type::getInt1Ty(F.getContext()); Type *Int32Ty = Type::getInt32Ty(F.getContext()); - Type *Int64Ty = Type::getInt64Ty(F.getContext()); // HVX vector -> v16i32/v32i32 // HVX vector predicate -> v512i1/v1024i1 auto getTypeForIntrin = [&](Type *Ty) -> Type * { @@ -1186,7 +1184,7 @@ auto HexagonVectorCombine::createHvxIntrinsic(IRBuilder<> &Builder, return VectorType::get(Int32Ty, HwLen / 4, /*Scalable*/ false); } // Non-HVX type. It should be a scalar. -assert(Ty == Int32Ty || Ty == Int64Ty); +assert(Ty == Int32Ty || Ty->isIntegerTy(64)); return Ty; }; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 60806e8 - Remove Shapet assignment operator that's identical to the default. NFC.
Author: Benjamin Kramer Date: 2020-12-10T10:58:41+01:00 New Revision: 60806e856a18262c544244f96739db2d9ac59424 URL: https://github.com/llvm/llvm-project/commit/60806e856a18262c544244f96739db2d9ac59424 DIFF: https://github.com/llvm/llvm-project/commit/60806e856a18262c544244f96739db2d9ac59424.diff LOG: Remove Shapet assignment operator that's identical to the default. NFC. Added: Modified: llvm/include/llvm/CodeGen/TileShapeInfo.h Removed: diff --git a/llvm/include/llvm/CodeGen/TileShapeInfo.h b/llvm/include/llvm/CodeGen/TileShapeInfo.h index f7ad81c25ebb..031d23555b7e 100644 --- a/llvm/include/llvm/CodeGen/TileShapeInfo.h +++ b/llvm/include/llvm/CodeGen/TileShapeInfo.h @@ -26,8 +26,6 @@ #include "llvm/CodeGen/Register.h" #include -using namespace llvm; - namespace llvm { class ShapeT { @@ -57,14 +55,6 @@ class ShapeT { bool operator!=(const ShapeT &Shape) { return !(*this == Shape); } - ShapeT &operator=(const ShapeT &RHS) { -Row = RHS.Row; -Col = RHS.Col; -RowImm = RHS.RowImm; -ColImm = RHS.ColImm; -return *this; - } - MachineOperand *getRow() const { return Row; } MachineOperand *getCol() const { return Col; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits