From fa9a368e39367f8be56d058eb7e0c9d6fefd21b5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 26 Jul 2021 17:29:07 +0200 Subject: [PATCH] [MergeICmps] Try to fix MSVC build failure Apparently this fails to line up the types -- try to sidestep the issue entirely by writing the code in a more reasonable way: Walk over the operands and perform a set lookup, rather than walking over the set and performing an operand scan. --- lib/Transforms/Scalar/MergeICmps.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Scalar/MergeICmps.cpp b/lib/Transforms/Scalar/MergeICmps.cpp index d3132e793d4..f90a9937db5 100644 --- a/lib/Transforms/Scalar/MergeICmps.cpp +++ b/lib/Transforms/Scalar/MergeICmps.cpp @@ -256,11 +256,10 @@ bool BCECmpBlock::canSinkBCECmpInst(const Instruction *Inst, } // Make sure this instruction does not use any of the BCE cmp block // instructions as operand. - for (auto BI : BlockInsts) { - if (is_contained(Inst->operands(), BI)) - return false; - } - return true; + return llvm::none_of(Inst->operands(), [&](const Value *Op) { + const Instruction *OpI = dyn_cast(Op); + return OpI && BlockInsts.contains(OpI); + }); } void BCECmpBlock::split(BasicBlock *NewParent, AliasAnalysis &AA) const {