From 4f356bb9b0a9dfc6e3d195d13ba45b4cfc1ed4c1 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 24 Feb 2009 02:00:40 +0000 Subject: Fix a ValueTracking rule: RHS means operand 1, not 0. Add a simple ashr instcombine to help expose this code. And apply the fix to SelectionDAG's copy of this code too. llvm-svn: 65364 --- llvm/lib/Analysis/ValueTracking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 7ac138b90ef..20fa69ea24f 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -625,7 +625,7 @@ unsigned llvm::ComputeNumSignBits(Value *V, TargetData *TD, unsigned Depth) { if (Tmp == 1) return 1; // Early out. // Special case decrementing a value (ADD X, -1): - if (ConstantInt *CRHS = dyn_cast(U->getOperand(0))) + if (ConstantInt *CRHS = dyn_cast(U->getOperand(1))) if (CRHS->isAllOnesValue()) { APInt KnownZero(TyBits, 0), KnownOne(TyBits, 0); APInt Mask = APInt::getAllOnesValue(TyBits); -- cgit v1.2.3