From 18db6813fe96616728f7e7f5921676c06a2764de Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2024 16:36:41 +0200 Subject: [PATCH] [LoopUnrollAnalyzer] Fix icmp simplification Fix a bug I introduced in 721fdf1c9a73269280a504cbba847f4979512b66. --- llvm/lib/Analysis/LoopUnrollAnalyzer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp b/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp index 8824cec86924f3..d8fe92ab14ccd3 100644 --- a/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp +++ b/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp @@ -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; + } } } }