Skip to content

Commit

Permalink
fixup! [loop count assumptions] convert loop iteration metadata to as…
Browse files Browse the repository at this point in the history
…sumptions
  • Loading branch information
F-Stuckmann committed Nov 26, 2024
1 parent 89dd3b2 commit fa41660
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions llvm/lib/Transforms/Utils/LoopIterCountAssumptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SCEVCommutativeExpr>(const_cast<SCEV *>(MinIterSCEV));
if (AE && NWF) {
AE->setNoWrapFlags(NWF);
MinIterSCEV = dyn_cast<const SCEV>(AE);
const SCEVCommutativeExpr *ConstCE =
dyn_cast<SCEVCommutativeExpr>(MinIterSCEV);
if (ConstCE && NWF) {
SCEVCommutativeExpr *CE = const_cast<SCEVCommutativeExpr *>(ConstCE);
CE->setNoWrapFlags(NWF);
MinIterSCEV = dyn_cast<const SCEV>(CE);
}

// Expansion of MinIterSCEV will result in \
Expand Down

0 comments on commit fa41660

Please sign in to comment.