Skip to content

Commit c691651

Browse files
committed
[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.
1 parent 0c99784 commit c691651

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/Scalar/MergeICmps.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,10 @@ bool BCECmpBlock::canSinkBCECmpInst(const Instruction *Inst,
256256
}
257257
// Make sure this instruction does not use any of the BCE cmp block
258258
// instructions as operand.
259-
for (auto BI : BlockInsts) {
260-
if (is_contained(Inst->operands(), BI))
261-
return false;
262-
}
263-
return true;
259+
return llvm::none_of(Inst->operands(), [&](const Value *Op) {
260+
const Instruction *OpI = dyn_cast<Instruction>(Op);
261+
return OpI && BlockInsts.contains(OpI);
262+
});
264263
}
265264

266265
void BCECmpBlock::split(BasicBlock *NewParent, AliasAnalysis &AA) const {

0 commit comments

Comments
 (0)