projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af1b4ad
)
Fold ashr -1, X into -1
author
Chris Lattner
<sabre@nondot.org>
Tue, 8 Oct 2002 16:16:40 +0000
(16:16 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Tue, 8 Oct 2002 16:16:40 +0000
(16:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4070
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/InstructionCombining.cpp
b/lib/Transforms/Scalar/InstructionCombining.cpp
index ec3ea074d929fb084aaa34efd537092ac27b28c9..f0e639742dc2a97dc71ff9da1a133b2fa304a2ac 100644
(file)
--- a/
lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/
lib/Transforms/Scalar/InstructionCombining.cpp
@@
-503,6
+503,12
@@
Instruction *InstCombiner::visitShiftInst(Instruction &I) {
return BinaryOperator::create(Instruction::Add, Op0, Op0, I.getName());
}
+
+ // shr int -1, X = -1 (for any arithmetic shift rights of ~0)
+ if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op0))
+ if (I.getOpcode() == Instruction::Shr && CSI->isAllOnesValue())
+ return ReplaceInstUsesWith(I, CSI);
+
return 0;
}