[PATCH] D145969: [GVNHoist] add cast to unbreak windows build

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 11:44:38 PDT 2023


kuhar added a comment.

In D145969#4190387 <https://reviews.llvm.org/D145969#4190387>, @nickdesaulniers wrote:

> I also wonder whether
>
>   diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
>   index abe38aa2a357..04f3df961662 100644
>   --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp
>   +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
>   @@ -810,13 +810,13 @@ void GVNHoist::checkSafety(CHIArgs C, BasicBlock *BB, GVNHoist::InsKind K,
>      int NumBBsOnAllPaths = MaxNumberOfBBSInPath;
>      const Instruction *T = BB->getTerminator();
>      for (auto CHI : C) {
>   -    Instruction *Insn = CHI.I;
>   +    const Instruction *Insn = CHI.I;
>        if (!Insn) // No instruction was inserted in this CHI.
>          continue;
>        // If the Terminator is some kind of "exotic terminator" that produces a
>        // value (such as InvokeInst, CallBrInst, or CatchSwitchInst) which the CHI
>        // uses, it is not safe to hoist the use above the def.
>   -    if (!T->use_empty() && is_contained(Insn->operands(), cast<const Value>(T)))
>   +    if (!T->use_empty() && is_contained(Insn->operands(), T))
>          continue;
>        if (K == InsKind::Scalar) {
>          if (safeToHoistScalar(BB, Insn->getParent(), NumBBsOnAllPaths))
>
> would have done the trick. Should I file a bug about `llvm::is_contained`/`std::find`/mscv19?

I'd consider defining a new `operator==` overload to handle cases like this instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145969/new/

https://reviews.llvm.org/D145969



More information about the llvm-commits mailing list