Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbaden committed Dec 3, 2024
1 parent ed6df23 commit dc9c16e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions third_party/intel/lib/LLVMIR/LLVMIRFreezeMaskedDivRem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@

using namespace llvm;

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

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

for (BasicBlock &BB : F) {
for (PHINode &PhiNode : BB.phis()) {
Changed |= processPhiNode(BB, &PhiNode);
Changed |= processPhiNode(&PhiNode);
}
}

Expand Down

0 comments on commit dc9c16e

Please sign in to comment.