[SCCP] Don't assume all Constants are ConstantInt
This fixes PR28269. llvm-svn: 273521
This commit is contained in:
parent
8871e7a49f
commit
d1fbf48566
|
@ -1419,7 +1419,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
|
||||||
|
|
||||||
// Shifting by the bitwidth or more is undefined.
|
// Shifting by the bitwidth or more is undefined.
|
||||||
if (Op1LV.isConstant()) {
|
if (Op1LV.isConstant()) {
|
||||||
auto *ShiftAmt = Op1LV.getConstantInt();
|
if (auto *ShiftAmt = Op1LV.getConstantInt())
|
||||||
if (ShiftAmt->getLimitedValue() >=
|
if (ShiftAmt->getLimitedValue() >=
|
||||||
ShiftAmt->getType()->getScalarSizeInBits())
|
ShiftAmt->getType()->getScalarSizeInBits())
|
||||||
break;
|
break;
|
||||||
|
@ -1436,7 +1436,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
|
||||||
|
|
||||||
// Shifting by the bitwidth or more is undefined.
|
// Shifting by the bitwidth or more is undefined.
|
||||||
if (Op1LV.isConstant()) {
|
if (Op1LV.isConstant()) {
|
||||||
auto *ShiftAmt = Op1LV.getConstantInt();
|
if (auto *ShiftAmt = Op1LV.getConstantInt())
|
||||||
if (ShiftAmt->getLimitedValue() >=
|
if (ShiftAmt->getLimitedValue() >=
|
||||||
ShiftAmt->getType()->getScalarSizeInBits())
|
ShiftAmt->getType()->getScalarSizeInBits())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -170,3 +170,13 @@ entry:
|
||||||
; CHECK-LABEL: @test10(
|
; CHECK-LABEL: @test10(
|
||||||
; CHECK: ret i64 undef
|
; CHECK: ret i64 undef
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GV = external global i32
|
||||||
|
|
||||||
|
define i32 @test11(i1 %tobool) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue