[SCCP] Turn loads of null into undef instead of zero initialized values

Surprisingly, this is a correctness issue: the mmx type exists for
calling convention purposes, LLVM doesn't have a zero representation for
them.

This partially fixes PR23999.

llvm-svn: 241142
This commit is contained in:
David Majnemer 2015-07-01 05:37:57 +00:00
parent 879d420999
commit 9402e27ae0
2 changed files with 6 additions and 1 deletions

View File

@ -1055,7 +1055,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) {
// load null -> null
if (isa<ConstantPointerNull>(Ptr) && I.getPointerAddressSpace() == 0)
return markConstant(IV, &I, Constant::getNullValue(I.getType()));
return markConstant(IV, &I, UndefValue::get(I.getType()));
// Transform load (constant global) into the value loaded.
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr)) {

View File

@ -27,3 +27,8 @@ define i32 @test2([4 x i32] %A) {
%B = extractvalue [4 x i32] %A, 1
ret i32 %B
}
define x86_mmx @test3() {
%load = load x86_mmx, x86_mmx* null
ret x86_mmx %load
}