aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-10 21:58:15 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-10 21:58:15 +0000
commit5a7717e498bc61246375a9df0061afa27d21e322 (patch)
tree94f451a24757b23f737a19be9df22968c1d11f39 /llvm/lib/IR/ConstantFold.cpp
parent89cf6d79ebc573647c562e5f2bd6c4d11a839f8b (diff)
downloadllvm-5a7717e498bc61246375a9df0061afa27d21e322.zip
llvm-5a7717e498bc61246375a9df0061afa27d21e322.tar.gz
llvm-5a7717e498bc61246375a9df0061afa27d21e322.tar.bz2
ConstantFold, InstSimplify: undef >>a x can be either -1 or 0, choose 0
Zero is usually a nicer constant to have than -1. llvm-svn: 223969
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 49ef302..a05c594 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -960,8 +960,9 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
// X >>a undef -> undef
if (isa<UndefValue>(C2))
return C2;
- // undef >>a X -> all ones
- return Constant::getAllOnesValue(C1->getType());
+ // TODO: undef >>a X -> undef if the shift is exact
+ // undef >>a X -> 0
+ return Constant::getNullValue(C1->getType());
case Instruction::Shl:
// X << undef -> undef
if (isa<UndefValue>(C2))