Skip to content

Commit dc9c16e

Browse files
committed
address review comments
1 parent ed6df23 commit dc9c16e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

third_party/intel/lib/LLVMIR/LLVMIRFreezeMaskedDivRem.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77
using namespace llvm;
88

9-
static bool processPhiNode(BasicBlock &BB, PHINode *PhiNode) {
10-
if (!any_of(PhiNode->incoming_values(), [](Use &U) {
9+
static bool processPhiNode(PHINode *PhiNode) {
10+
if (none_of(PhiNode->incoming_values(), [](Use &U) {
1111
Constant *C = dyn_cast<Constant>(&U);
1212
return isa<UndefValue>(U) || C && C->isNullValue();
1313
})) {
1414
return false;
1515
}
1616

1717
bool Changed = false;
18-
for (Instruction &I : BB) {
18+
BasicBlock *BB = const_cast<BasicBlock *>(PhiNode->getParent());
19+
for (Instruction &I : *BB) {
1920
if (I.getOpcode() == Instruction::SDiv ||
2021
I.getOpcode() == Instruction::SRem) {
2122
const size_t OpIdx = 1;
@@ -35,7 +36,7 @@ static bool runOnFunction(Function &F) {
3536

3637
for (BasicBlock &BB : F) {
3738
for (PHINode &PhiNode : BB.phis()) {
38-
Changed |= processPhiNode(BB, &PhiNode);
39+
Changed |= processPhiNode(&PhiNode);
3940
}
4041
}
4142

0 commit comments

Comments
 (0)