[llvm] [VPlan]: During VPRegionBlock::clone, sync the NUW of CanIVInfo (PR #212266)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 27 08:12:33 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-vectorizers
Author: Hassnaa Hamdi (hassnaaHamdi)
<details>
<summary>Changes</summary>
VPRegionBlock::clone() creates the cloned loop region's canonical IV info via createLoopRegion(), which always starts with NUW set. If the original region's canonical IV had already had its NUW flag cleared the clone did not carry that over, leaving the cloned region's CanIVInfo inconsistent with the original. Propagate the cleared NUW flag to the clone so both regions agree on whether the canonical IV is NUW.
---
Full diff: https://github.com/llvm/llvm-project/pull/212266.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/VPlan.cpp (+3)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 37060b15a7b97..a4086a1aa8822 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -778,6 +778,9 @@ VPRegionBlock *VPRegionBlock::clone() {
if (getHeaderMask())
NewRegion->createHeaderMask();
+ if (CanIV && !hasCanonicalIVNUW())
+ NewRegion->CanIVInfo->clearNUW();
+
for (VPBlockBase *Block : vp_depth_first_shallow(NewEntry))
Block->setParent(NewRegion);
return NewRegion;
``````````
</details>
https://github.com/llvm/llvm-project/pull/212266
More information about the llvm-commits
mailing list