[llvm] c691651 - [MergeICmps] Try to fix MSVC build failure
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 26 08:31:36 PDT 2021
Author: Nikita Popov
Date: 2021-07-26T17:31:27+02:00
New Revision: c691651c53485a07db5b529e5a465eee397b7987
URL: https://github.com/llvm/llvm-project/commit/c691651c53485a07db5b529e5a465eee397b7987
DIFF: https://github.com/llvm/llvm-project/commit/c691651c53485a07db5b529e5a465eee397b7987.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Scalar/MergeICmps.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/MergeICmps.cpp b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
index d3132e793d40..f90a9937db5c 100644
--- a/llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ b/llvm/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<Instruction>(Op);
+ return OpI && BlockInsts.contains(OpI);
+ });
}
void BCECmpBlock::split(BasicBlock *NewParent, AliasAnalysis &AA) const {
More information about the llvm-commits
mailing list