[llvm] 5b07750 - [Transforms] Silence a warning in SROA.cpp (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 02:45:21 PST 2024


Author: Jie Fu
Date: 2024-12-12T18:44:19+08:00
New Revision: 5b077506de26b1dfce1926895548b86f2106bed9

URL: https://github.com/llvm/llvm-project/commit/5b077506de26b1dfce1926895548b86f2106bed9
DIFF: https://github.com/llvm/llvm-project/commit/5b077506de26b1dfce1926895548b86f2106bed9.diff

LOG: [Transforms] Silence a warning in SROA.cpp (NFC)

/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:5526:48:
 error: '&&' within '||' [-Werror,-Wlogical-op-parentheses]
          if (!SI->isSimple() || PartitionType && UserTy != PartitionType)
                              ~~ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/llvm-project/llvm/lib/Transforms/Scalar/SROA.cpp:5526:48:
 note: place parentheses around the '&&' expression to silence this warning
          if (!SI->isSimple() || PartitionType && UserTy != PartitionType)
                                               ^
                                 (                                       )
1 error generated.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/SROA.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 5b78b9c80a92afd..2cb3525231eac98 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -5523,7 +5523,7 @@ bool SROA::propagateStoredValuesToLoads(AllocaInst &AI, AllocaSlices &AS) {
           Insts.push_back(User);
         } else if (auto *SI = dyn_cast<StoreInst>(User)) {
           Type *UserTy = SI->getValueOperand()->getType();
-          if (!SI->isSimple() || PartitionType && UserTy != PartitionType)
+          if (!SI->isSimple() || (PartitionType && UserTy != PartitionType))
             AllSameAndValid = false;
           PartitionType = UserTy;
           Insts.push_back(User);


        


More information about the llvm-commits mailing list