return V;
// undef >>l X -> 0
+ // undef >>l X -> undef (if it's exact)
if (match(Op0, m_Undef()))
- return Constant::getNullValue(Op0->getType());
+ return isExact ? UndefValue::get(Op0->getType())
+ : Constant::getNullValue(Op0->getType());
// (X << A) >> A -> X
Value *X;
return Op0;
// undef >>a X -> all ones
+ // undef >>a X -> undef (if it's exact)
if (match(Op0, m_Undef()))
- return Constant::getAllOnesValue(Op0->getType());
+ return isExact ? UndefValue::get(Op0->getType())
+ : Constant::getAllOnesValue(Op0->getType());
// (X << A) >> A -> X
Value *X;
%b = sdiv i32 %a, 0
ret i32 %b
}
+
+; CHECK-LABEL: @test22
+; CHECK: ret i32 undef
+define i32 @test22(i32 %a) {
+ %b = ashr exact i32 undef, %a
+ ret i32 %b
+}
+
+; CHECK-LABEL: @test23
+; CHECK: ret i32 undef
+define i32 @test23(i32 %a) {
+ %b = lshr exact i32 undef, %a
+ ret i32 %b
+}