diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-07-01 05:37:57 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-07-01 05:37:57 +0000 |
| commit | 9402e27ae0b29498cdbeb03860adfad5750c0005 (patch) | |
| tree | 06ddd63cba47328eb4764c91ffa3f4fdb94ec619 /llvm | |
| parent | 879d42099927c3d044e88cc672f34ee4ab4b7657 (diff) | |
| download | bcm5719-llvm-9402e27ae0b29498cdbeb03860adfad5750c0005.tar.gz bcm5719-llvm-9402e27ae0b29498cdbeb03860adfad5750c0005.zip | |
[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
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/SCCP/crash.ll | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index bc068f78c57..305175ff8f7 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -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)) { diff --git a/llvm/test/Transforms/SCCP/crash.ll b/llvm/test/Transforms/SCCP/crash.ll index 88528902d72..3ec1fd21745 100644 --- a/llvm/test/Transforms/SCCP/crash.ll +++ b/llvm/test/Transforms/SCCP/crash.ll @@ -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 +} |

