[llvm] r313482 - Remove uses of deprecated std::not1.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 10:59:34 PDT 2017


On Sun, Sep 17, 2017 at 4:21 AM Benjamin Kramer via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: d0k
> Date: Sun Sep 17 04:19:53 2017
> New Revision: 313482
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313482&view=rev
> Log:
> Remove uses of deprecated std::not1.
>
> Lambdas are slightly more verbose, but also more readable. No
> functionality change intended.
>
> Modified:
>     llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
>
> Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=313482&r1=313481&r2=313482&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Sun Sep 17 04:19:53
> 2017
> @@ -147,7 +147,7 @@ template <typename Predicate>
>  bool TypeSetByHwMode::constrain(Predicate P) {
>    bool Changed = false;
>    for (auto &I : *this)
> -    Changed |= berase_if(I.second, std::not1(std::ref(P)));
> +    Changed |= berase_if(I.second, [&P](MVT VT) { return !P(VT); });
>

For locally used lambdas (lambdas that don't escape their scope (through
type erasure in std::function, etc)) I think it's probably best to just use
[&] as a rule?


>    return Changed;
>  }
>
> @@ -436,11 +436,11 @@ bool TypeInfer::EnforceSmallerThan(TypeS
>      TypeSetByHwMode::SetType &B = Big.get(M);
>
>      if (any_of(S, isIntegerOrPtr) && any_of(S, isIntegerOrPtr)) {
> -      auto NotInt = std::not1(std::ref(isIntegerOrPtr));
> +      auto NotInt = [](MVT VT) { return !isIntegerOrPtr(VT); };
>        Changed |= berase_if(S, NotInt) |
>                   berase_if(B, NotInt);
>      } else if (any_of(S, isFloatingPoint) && any_of(B, isFloatingPoint)) {
> -      auto NotFP = std::not1(std::ref(isFloatingPoint));
> +      auto NotFP = [](MVT VT) { return !isFloatingPoint(VT); };
>        Changed |= berase_if(S, NotFP) |
>                   berase_if(B, NotFP);
>      } else if (S.empty() || B.empty()) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170918/95b75456/attachment.html>


More information about the llvm-commits mailing list