summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp4
-rw-r--r--llvm/lib/IR/ConstantFold.cpp5
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 1c5a917cbec..408768e8515 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1422,11 +1422,11 @@ static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
if (match(Op0, m_AllOnes()))
return Op0;
- // undef >>a X -> all ones
+ // undef >>a X -> 0
// undef >>a X -> undef (if it's exact)
if (match(Op0, m_Undef()))
return isExact ? UndefValue::get(Op0->getType())
- : Constant::getAllOnesValue(Op0->getType());
+ : Constant::getNullValue(Op0->getType());
// (X << A) >> A -> X
Value *X;
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 49ef3024033..a05c594ac8e 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))
OpenPOWER on IntegriCloud