From fa41660db5acf0d6609aef49e5ed84c64fac14c5 Mon Sep 17 00:00:00 2001 From: Fabian Stuckmann Date: Tue, 26 Nov 2024 14:12:42 +0000 Subject: [PATCH] fixup! [loop count assumptions] convert loop iteration metadata to assumptions --- .../lib/Transforms/Utils/LoopIterCountAssumptions.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Utils/LoopIterCountAssumptions.cpp b/llvm/lib/Transforms/Utils/LoopIterCountAssumptions.cpp index 57bc879591a5..54a35777c040 100644 --- a/llvm/lib/Transforms/Utils/LoopIterCountAssumptions.cpp +++ b/llvm/lib/Transforms/Utils/LoopIterCountAssumptions.cpp @@ -131,11 +131,12 @@ void insertMinIterAssumption(ICmpInst &LoopCmpInstr, BasicBlock &LoopHeader, // expression can be simplified in later passes SCEV::NoWrapFlags NWF = BunldedSCEV.AddRecExpr->getNoWrapFlags( SCEV::NoWrapFlags(/*Mask=*/SCEV::FlagNUW | SCEV::FlagNSW)); - SCEVCommutativeExpr *AE = - dyn_cast(const_cast(MinIterSCEV)); - if (AE && NWF) { - AE->setNoWrapFlags(NWF); - MinIterSCEV = dyn_cast(AE); + const SCEVCommutativeExpr *ConstCE = + dyn_cast(MinIterSCEV); + if (ConstCE && NWF) { + SCEVCommutativeExpr *CE = const_cast(ConstCE); + CE->setNoWrapFlags(NWF); + MinIterSCEV = dyn_cast(CE); } // Expansion of MinIterSCEV will result in \