Skip to content

Commit

Permalink
[LoopUnrollAnalyzer] Fix icmp simplification
Browse files Browse the repository at this point in the history
Fix a bug I introduced in 721fdf1.
  • Loading branch information
nikic committed Aug 27, 2024
1 parent d517b22 commit 18db681
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ bool UnrolledInstAnalyzer::visitCmpInst(CmpInst &I) {
if (SimplifiedRHS != SimplifiedAddresses.end()) {
SimplifiedAddress &LHSAddr = SimplifiedLHS->second;
SimplifiedAddress &RHSAddr = SimplifiedRHS->second;
if (LHSAddr.Base == RHSAddr.Base)
return ICmpInst::compare(LHSAddr.Offset, RHSAddr.Offset,
I.getPredicate());
if (LHSAddr.Base == RHSAddr.Base) {
bool Res = ICmpInst::compare(LHSAddr.Offset, RHSAddr.Offset,
I.getPredicate());
SimplifiedValues[&I] = ConstantInt::getBool(I.getType(), Res);
return true;
}
}
}
}
Expand Down

0 comments on commit 18db681

Please sign in to comment.