[GVNHoist] add cast to unbreak windows build
authorNick Desaulniers <ndesaulniers@google.com>
Mon, 13 Mar 2023 18:22:25 +0000 (11:22 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Mon, 13 Mar 2023 18:22:49 +0000 (11:22 -0700)
Follow up to
commit 831e99fee90e ("[GVNHoist] don't hoist callbr users into the callbr's block")

Looks like MSVC has trouble with llvm::is_contained. Unbreak the build.

Link: https://lab.llvm.org/buildbot/#/builders/127/builds/45021/steps/7/logs/stdio
Reviewed By: hans, kuhar

Differential Revision: https://reviews.llvm.org/D145969

llvm/lib/Transforms/Scalar/GVNHoist.cpp

index f13b52f..abe38aa 100644 (file)
@@ -816,7 +816,7 @@ void GVNHoist::checkSafety(CHIArgs C, BasicBlock *BB, GVNHoist::InsKind K,
     // 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(), T))
+    if (!T->use_empty() && is_contained(Insn->operands(), cast<const Value>(T)))
       continue;
     if (K == InsKind::Scalar) {
       if (safeToHoistScalar(BB, Insn->getParent(), NumBBsOnAllPaths))