[llvm-branch-commits] [llvm-branch] r258869 - Merging r258184:
Author: sanjoy Date: Tue Jan 26 16:29:46 2016 New Revision: 258869 URL: http://llvm.org/viewvc/llvm-project?rev=258869&view=rev Log: Merging r258184: r258184 | sanjoy | 2016-01-19 12:53:51 -0800 (Tue, 19 Jan 2016) | 20 lines [SCEV] Fix PR26207 In some cases, the max backedge taken count can be more conservative than the exact backedge taken count (for instance, because ScalarEvolution::getRange is not control-flow sensitive whereas computeExitLimitFromICmp can be). In these cases, computeExitLimitFromCond (specifically the bit that deals with `and` and `or` instructions) can create an ExitLimit instance with a `SCEVCouldNotCompute` max backedge count expression, but a computable exact backedge count expression. This violates an implicit SCEV assumption: a computable exact BE count should imply a computable max BE count. This change - Makes the above implicit invariant explicit by adding an assert to ExitLimit's constructor - Changes `computeExitLimitFromCond` to be more robust around conservative max backedge counts Added: llvm/branches/release_38/test/Transforms/IndVarSimplify/pr26207.ll - copied unchanged from r258184, llvm/trunk/test/Transforms/IndVarSimplify/pr26207.ll Modified: llvm/branches/release_38/ (props changed) llvm/branches/release_38/include/llvm/Analysis/ScalarEvolution.h llvm/branches/release_38/lib/Analysis/ScalarEvolution.cpp Propchange: llvm/branches/release_38/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jan 26 16:29:46 2016 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258207,258221,258273,258325,258406,258416,258428,258436,258690,258729 +/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258690,258729 Modified: llvm/branches/release_38/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/include/llvm/Analysis/ScalarEvolution.h?rev=258869&r1=258868&r2=258869&view=diff == --- llvm/branches/release_38/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/branches/release_38/include/llvm/Analysis/ScalarEvolution.h Tue Jan 26 16:29:46 2016 @@ -412,7 +412,11 @@ namespace llvm { /*implicit*/ ExitLimit(const SCEV *E) : Exact(E), Max(E) {} - ExitLimit(const SCEV *E, const SCEV *M) : Exact(E), Max(M) {} + ExitLimit(const SCEV *E, const SCEV *M) : Exact(E), Max(M) { +assert((isa(Exact) || +!isa(Max)) && + "Exact is not allowed to be less precise than Max"); + } /// Test whether this ExitLimit contains any computed information, or /// whether it's all SCEVCouldNotCompute values. Modified: llvm/branches/release_38/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Analysis/ScalarEvolution.cpp?rev=258869&r1=258868&r2=258869&view=diff == --- llvm/branches/release_38/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/branches/release_38/lib/Analysis/ScalarEvolution.cpp Tue Jan 26 16:29:46 2016 @@ -5368,6 +5368,14 @@ ScalarEvolution::computeExitLimitFromCon BECount = EL0.Exact; } + // There are cases (e.g. PR26207) where computeExitLimitFromCond is able + // to be more aggressive when computing BECount than when computing + // MaxBECount. In these cases it is possible for EL0.Exact and EL1.Exact + // to match, but for EL0.Max and EL1.Max to not. + if (isa(MaxBECount) && + !isa(BECount)) +MaxBECount = BECount; + return ExitLimit(BECount, MaxBECount); } if (BO->getOpcode() == Instruction::Or) { ___ 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] bd166c8 - Nit: fix spacing
Author: Sanjoy Das Date: 2021-01-06T09:40:50-08:00 New Revision: bd166c813c55b0e1703d17d87bf71a9e3966a25a URL: https://github.com/llvm/llvm-project/commit/bd166c813c55b0e1703d17d87bf71a9e3966a25a DIFF: https://github.com/llvm/llvm-project/commit/bd166c813c55b0e1703d17d87bf71a9e3966a25a.diff LOG: Nit: fix spacing Differential Revision: https://reviews.llvm.org/D93996 Added: Modified: mlir/test/Dialect/GPU/async-region.mlir Removed: diff --git a/mlir/test/Dialect/GPU/async-region.mlir b/mlir/test/Dialect/GPU/async-region.mlir index 216ccceda1f0..84a0356975b0 100644 --- a/mlir/test/Dialect/GPU/async-region.mlir +++ b/mlir/test/Dialect/GPU/async-region.mlir @@ -103,7 +103,7 @@ module attributes {gpu.container_module} { return } - // CHECK-LABEL:func @async_execute_with_result(%{{.*}}: index) + // CHECK-LABEL:func @async_execute_with_result(%{{.*}}: index) func @async_execute_with_result(%sz : index) -> index { // CHECK: %[[a0:.*]], %[[f0:.*]]:2 = async.execute // CHECK-SAME: -> (!async.value, !async.value) ___ 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] 6173d12 - Remove allow-unregistered-dialect from some tests that don't need it
Author: Sanjoy Das Date: 2021-01-06T09:40:50-08:00 New Revision: 6173d1277be04739bc5d977546309f7c765156c8 URL: https://github.com/llvm/llvm-project/commit/6173d1277be04739bc5d977546309f7c765156c8 DIFF: https://github.com/llvm/llvm-project/commit/6173d1277be04739bc5d977546309f7c765156c8.diff LOG: Remove allow-unregistered-dialect from some tests that don't need it Differential Revision: https://reviews.llvm.org/D93982 Added: Modified: mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir Removed: diff --git a/mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir b/mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir index 06ccd1e8f4ee..d1b1af813163 100644 --- a/mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir +++ b/mlir/test/Conversion/GPUCommon/lower-alloc-to-gpu-runtime-calls.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s --gpu-to-llvm | FileCheck %s +// RUN: mlir-opt %s --gpu-to-llvm | FileCheck %s module attributes {gpu.container_module} { func @main() { diff --git a/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir b/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir index c63936848e9a..3fcf3a00ab9a 100644 --- a/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir +++ b/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s --gpu-to-llvm="gpu-binary-annotation=nvvm.cubin" | FileCheck %s -// RUN: mlir-opt -allow-unregistered-dialect %s --gpu-to-llvm="gpu-binary-annotation=rocdl.hsaco" | FileCheck %s --check-prefix=ROCDL +// RUN: mlir-opt %s --gpu-to-llvm="gpu-binary-annotation=nvvm.cubin" | FileCheck %s +// RUN: mlir-opt %s --gpu-to-llvm="gpu-binary-annotation=rocdl.hsaco" | FileCheck %s --check-prefix=ROCDL module attributes {gpu.container_module} { diff --git a/mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir b/mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir index 790c92f92ec9..162c2f4e838a 100644 --- a/mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir +++ b/mlir/test/Conversion/GPUCommon/lower-memcpy-to-gpu-runtime-calls.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s --gpu-to-llvm | FileCheck %s +// RUN: mlir-opt %s --gpu-to-llvm | FileCheck %s module attributes {gpu.container_module} { diff --git a/mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir b/mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir index b6eacfb969dd..3234e885185e 100644 --- a/mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir +++ b/mlir/test/Conversion/GPUCommon/lower-wait-to-gpu-runtime-calls.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s --gpu-to-llvm | FileCheck %s +// RUN: mlir-opt %s --gpu-to-llvm | FileCheck %s module attributes {gpu.container_module} { ___ 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] a855c94 - [NFC] Don't copy MachineFrameInfo on each invocation of HasAlias
Author: Sanjoy Das Date: 2021-01-06T18:59:20-08:00 New Revision: a855c9403fbac6be8acaf1651932084645a00d11 URL: https://github.com/llvm/llvm-project/commit/a855c9403fbac6be8acaf1651932084645a00d11 DIFF: https://github.com/llvm/llvm-project/commit/a855c9403fbac6be8acaf1651932084645a00d11.diff LOG: [NFC] Don't copy MachineFrameInfo on each invocation of HasAlias Also fix a typo in a comment. This fixes a compile time issue in XLA (https://www.tensorflow.org/xla). Differential Revision: https://reviews.llvm.org/D94182 Added: Modified: llvm/lib/CodeGen/MachineInstr.cpp Removed: diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 900abd2b260d..c1c7849fbe30 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1253,13 +1253,82 @@ bool MachineInstr::isSafeToMove(AAResults *AA, bool &SawStore) const { return true; } +static bool MemOperandsHaveAlias(const MachineFrameInfo &MFI, AAResults *AA, + bool UseTBAA, const MachineMemOperand *MMOa, + const MachineMemOperand *MMOb) { + // The following interface to AA is fashioned after DAGCombiner::isAlias and + // operates with MachineMemOperand offset with some important assumptions: + // - LLVM fundamentally assumes flat address spaces. + // - MachineOperand offset can *only* result from legalization and cannot + // affect queries other than the trivial case of overlap checking. + // - These offsets never wrap and never step outside of allocated objects. + // - There should never be any negative offsets here. + // + // FIXME: Modify API to hide this math from "user" + // Even before we go to AA we can reason locally about some memory objects. It + // can save compile time, and possibly catch some corner cases not currently + // covered. + + int64_t OffsetA = MMOa->getOffset(); + int64_t OffsetB = MMOb->getOffset(); + int64_t MinOffset = std::min(OffsetA, OffsetB); + + uint64_t WidthA = MMOa->getSize(); + uint64_t WidthB = MMOb->getSize(); + bool KnownWidthA = WidthA != MemoryLocation::UnknownSize; + bool KnownWidthB = WidthB != MemoryLocation::UnknownSize; + + const Value *ValA = MMOa->getValue(); + const Value *ValB = MMOb->getValue(); + bool SameVal = (ValA && ValB && (ValA == ValB)); + if (!SameVal) { +const PseudoSourceValue *PSVa = MMOa->getPseudoValue(); +const PseudoSourceValue *PSVb = MMOb->getPseudoValue(); +if (PSVa && ValB && !PSVa->mayAlias(&MFI)) + return false; +if (PSVb && ValA && !PSVb->mayAlias(&MFI)) + return false; +if (PSVa && PSVb && (PSVa == PSVb)) + SameVal = true; + } + + if (SameVal) { +if (!KnownWidthA || !KnownWidthB) + return true; +int64_t MaxOffset = std::max(OffsetA, OffsetB); +int64_t LowWidth = (MinOffset == OffsetA) ? WidthA : WidthB; +return (MinOffset + LowWidth > MaxOffset); + } + + if (!AA) +return true; + + if (!ValA || !ValB) +return true; + + assert((OffsetA >= 0) && "Negative MachineMemOperand offset"); + assert((OffsetB >= 0) && "Negative MachineMemOperand offset"); + + int64_t OverlapA = + KnownWidthA ? WidthA + OffsetA - MinOffset : MemoryLocation::UnknownSize; + int64_t OverlapB = + KnownWidthB ? WidthB + OffsetB - MinOffset : MemoryLocation::UnknownSize; + + AliasResult AAResult = AA->alias( + MemoryLocation(ValA, OverlapA, UseTBAA ? MMOa->getAAInfo() : AAMDNodes()), + MemoryLocation(ValB, OverlapB, + UseTBAA ? MMOb->getAAInfo() : AAMDNodes())); + + return (AAResult != NoAlias); +} + bool MachineInstr::mayAlias(AAResults *AA, const MachineInstr &Other, bool UseTBAA) const { const MachineFunction *MF = getMF(); const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo(); const MachineFrameInfo &MFI = MF->getFrameInfo(); - // Execulde call instruction which may alter the memory but can not be handled + // Exclude call instruction which may alter the memory but can not be handled // by this function. if (isCall() || Other.isCall()) return true; @@ -1287,83 +1356,11 @@ bool MachineInstr::mayAlias(AAResults *AA, const MachineInstr &Other, if (NumChecks > TII->getMemOperandAACheckLimit()) return true; - auto HasAlias = [MFI, AA, UseTBAA](const MachineMemOperand *MMOa, - const MachineMemOperand *MMOb) { -// The following interface to AA is fashioned after DAGCombiner::isAlias -// and operates with MachineMemOperand offset with some important -// assumptions: -// - LLVM fundamentally assumes flat address spaces. -// - MachineOperand offset can *only* result from legalization and -// cannot affect queries other than the trivial case of overlap -// checking. -// - These offsets never