[llvm] 1e50d06 - [Analysis] fix swapped operands to computeConstantRange

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 10:15:07 PST 2022


Author: Sanjay Patel
Date: 2022-01-04T13:13:50-05:00
New Revision: 1e50d064666f7e807ac96655405c5678251475f5

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

LOG: [Analysis] fix swapped operands to computeConstantRange

This was noted in post-commit review for D116322 / 0edf99950e6 .

I am not seeing how to expose the bug in a test though because
we don't pass an assumption cache into this analysis from there.

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 16bd0adff983..758980187180 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7146,8 +7146,8 @@ ConstantRange llvm::computeConstantRange(const Value *V, bool ForSigned,
         continue;
       // TODO: Set "ForSigned" parameter via Cmp->isSigned()?
       ConstantRange RHS =
-          computeConstantRange(Cmp->getOperand(1), UseInstrInfo,
-                               /* ForSigned */ false, AC, I, DT, Depth + 1);
+          computeConstantRange(Cmp->getOperand(1), /* ForSigned */ false,
+                               UseInstrInfo, AC, I, DT, Depth + 1);
       CR = CR.intersectWith(
           ConstantRange::makeAllowedICmpRegion(Cmp->getPredicate(), RHS));
     }


        


More information about the llvm-commits mailing list