1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[SCCP] Make sure SCCP and ConstantFolding agree on undef >> a.

Currently SCCP folds the value to -1, while ConstantProp folds to
0. This changes SCCP to do what ConstantFolding does.

llvm-svn: 289147
This commit is contained in:
Davide Italiano 2016-12-08 22:28:53 +00:00
parent 46d667b82b
commit b16c6ac588
2 changed files with 4 additions and 4 deletions

View File

@ -1396,8 +1396,8 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
break;
}
// undef >>a X -> all ones
markForcedConstant(&I, Constant::getAllOnesValue(ITy));
// undef >>a X -> 0
markForcedConstant(&I, Constant::getNullValue(ITy));
return true;
case Instruction::LShr:
case Instruction::Shl:

View File

@ -135,7 +135,7 @@ define i32 @test6() {
%t = ashr i32 undef, 31
ret i32 %t
; CHECK-LABEL: @test6(
; CHECK: ret i32 -1
; CHECK: ret i32 0
}
; Make sure lshr produces a possible value
@ -178,5 +178,5 @@ entry:
%shr4 = ashr i32 undef, zext (i1 icmp eq (i32* bitcast (i32 (i1)* @test11 to i32*), i32* @GV) to i32)
ret i32 %shr4
; CHECK-LABEL: @test11(
; CHECK: ret i32 -1
; CHECK: ret i32 0
}