From 65a873caa251873876bda2a1b024ac9031c4a387 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 10 Nov 2006 23:38:52 +0000 Subject: [PATCH] Fix InstCombine/2006-11-10-ashr-miscompile.ll a miscompilation introduced by the shr -> [al]shr patch. This was reduced from 176.gcc. llvm-svn: 31653 --- lib/Transforms/Scalar/InstructionCombining.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 65ebf641d6f..f636442bb7f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5082,10 +5082,10 @@ Instruction *InstCombiner::visitShiftInst(ShiftInst &I) { return ReplaceInstUsesWith(I, Op0); // X >>s undef -> X } - // shr int -1, X = -1 (for any arithmetic shift rights of ~0) - if (!isLeftShift) + // ashr int -1, X = -1 (for any arithmetic shift rights of ~0) + if (I.getOpcode() == Instruction::AShr) if (ConstantInt *CSI = dyn_cast(Op0)) - if (CSI->isAllOnesValue() && Op0->getType()->isSigned()) + if (CSI->isAllOnesValue()) return ReplaceInstUsesWith(I, CSI); // Try to fold constant and into select arguments.