[llvm] df6087e - Move debug-only code inside LLVM_DEUG to prevent unused variable warnings.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 23:33:25 PDT 2022


Looks like maybe this could be simplified to:
assert(cast<SCEVUnknown>(...) == cast<SCEVUnknown>(...))

because the casts will do the assert checking on the first part/type check

On Thu, Jun 16, 2022 at 2:02 PM Sterling Augustine via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Sterling Augustine
> Date: 2022-06-16T14:01:26-07:00
> New Revision: df6087ee379488b0251805c491f6b0b6b8c6ed1d
>
> URL: https://github.com/llvm/llvm-project/commit/df6087ee379488b0251805c491f6b0b6b8c6ed1d
> DIFF: https://github.com/llvm/llvm-project/commit/df6087ee379488b0251805c491f6b0b6b8c6ed1d.diff
>
> LOG: Move debug-only code inside LLVM_DEUG to prevent unused variable warnings.
>
> Added:
>
>
> Modified:
>     llvm/lib/Analysis/DependenceAnalysis.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
> index 31794b7317d5..3d2d84ecadb4 100644
> --- a/llvm/lib/Analysis/DependenceAnalysis.cpp
> +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
> @@ -3341,12 +3341,14 @@ bool DependenceInfo::tryDelinearizeFixedSize(
>      Instruction *Src, Instruction *Dst, const SCEV *SrcAccessFn,
>      const SCEV *DstAccessFn, SmallVectorImpl<const SCEV *> &SrcSubscripts,
>      SmallVectorImpl<const SCEV *> &DstSubscripts) {
> -  const SCEVUnknown *SrcBase =
> -      dyn_cast<SCEVUnknown>(SE->getPointerBase(SrcAccessFn));
> -  const SCEVUnknown *DstBase =
> -      dyn_cast<SCEVUnknown>(SE->getPointerBase(DstAccessFn));
> -  assert(SrcBase && DstBase && SrcBase == DstBase &&
> -         "expected src and dst scev unknowns to be equal");
> +  LLVM_DEBUG({
> +    const SCEVUnknown *SrcBase =
> +        dyn_cast<SCEVUnknown>(SE->getPointerBase(SrcAccessFn));
> +    const SCEVUnknown *DstBase =
> +        dyn_cast<SCEVUnknown>(SE->getPointerBase(DstAccessFn));
> +    assert(SrcBase && DstBase && SrcBase == DstBase &&
> +           "expected src and dst scev unknowns to be equal");
> +    });
>
>    SmallVector<int, 4> SrcSizes;
>    SmallVector<int, 4> DstSizes;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list