[llvm] c94cbc3 - Fix gcc warning about ambiguous if-else chain

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 06:36:56 PDT 2022


Author: Simon Pilgrim
Date: 2022-09-23T14:36:28+01:00
New Revision: c94cbc343e848aeef3901c34a58d75aaaf656364

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

LOG: Fix gcc warning about ambiguous if-else chain

Fixes warnings introduced by D111968

Added: 
    

Modified: 
    llvm/lib/Analysis/TargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index cde0b8174502..9dd8fddda27c 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -727,11 +727,12 @@ TargetTransformInfo::getOperandInfo(const Value *V) {
   OperandValueProperties OpProps = OP_None;
 
   if (isa<ConstantInt>(V) || isa<ConstantFP>(V)) {
-    if (const auto *CI = dyn_cast<ConstantInt>(V))
+    if (const auto *CI = dyn_cast<ConstantInt>(V)) {
       if (CI->getValue().isPowerOf2())
         OpProps = OP_PowerOf2;
       else if (CI->getValue().isNegatedPowerOf2())
         OpProps = OP_NegatedPowerOf2;
+    }
     return {OK_UniformConstantValue, OpProps};
   }
 
@@ -750,11 +751,12 @@ TargetTransformInfo::getOperandInfo(const Value *V) {
     OpInfo = OK_NonUniformConstantValue;
     if (Splat) {
       OpInfo = OK_UniformConstantValue;
-      if (auto *CI = dyn_cast<ConstantInt>(Splat))
+      if (auto *CI = dyn_cast<ConstantInt>(Splat)) {
         if (CI->getValue().isPowerOf2())
           OpProps = OP_PowerOf2;
         else if (CI->getValue().isNegatedPowerOf2())
           OpProps = OP_NegatedPowerOf2;
+      }
     } else if (const auto *CDS = dyn_cast<ConstantDataSequential>(V)) {
       bool AllPow2 = true, AllNegPow2 = true;
       for (unsigned I = 0, E = CDS->getNumElements(); I != E; ++I) {


        


More information about the llvm-commits mailing list