[llvm] [VPlan] Keep common flags during CSE. (PR #157664)
    Ramkumar Ramachandra via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Sep  9 06:26:05 PDT 2025
    
    
  
================
@@ -392,6 +392,42 @@ void VPPartialReductionRecipe::print(raw_ostream &O, const Twine &Indent,
 }
 #endif
 
+void VPIRFlags::intersectFlags(const VPIRFlags &Other) {
+  assert(OpType == Other.OpType && "OpType must match");
+  switch (OpType) {
+  case OperationType::OverflowingBinOp:
+    WrapFlags.HasNUW &= Other.WrapFlags.HasNUW;
+    WrapFlags.HasNSW &= Other.WrapFlags.HasNSW;
+    break;
+  case OperationType::Trunc:
+    TruncFlags.HasNUW &= Other.TruncFlags.HasNUW;
+    TruncFlags.HasNSW &= Other.TruncFlags.HasNSW;
+    break;
+  case OperationType::DisjointOp:
+    DisjointFlags.IsDisjoint &= Other.DisjointFlags.IsDisjoint;
+    break;
+  case OperationType::PossiblyExactOp:
+    ExactFlags.IsExact = Other.ExactFlags.IsExact;
----------------
artagnon wrote:
```suggestion
    ExactFlags.IsExact &= Other.ExactFlags.IsExact;
```
https://github.com/llvm/llvm-project/pull/157664
    
    
More information about the llvm-commits
mailing list