Index: projects/clang370-import/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff =================================================================== --- projects/clang370-import/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff (revision 288076) +++ projects/clang370-import/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff (nonexistent) @@ -1,88 +0,0 @@ -Pull in r241142 from upstream llvm trunk (by David Majnemer): - - [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. - -Pull in r241143 from upstream llvm trunk (by David Majnemer): - - [LoopUnroll] Use undef for phis with no value live - - We would create a phi node with a zero initialized operand instead of - undef in the case where no value was originally available. This was - problematic for x86_mmx which has no null value. - -These fix a "Cannot create a null constant of that type!" error when -compiling the graphics/sdl2_gfx port with MMX enabled. - -Introduced here: http://svnweb.freebsd.org/changeset/base/285149 - -Index: lib/Transforms/Scalar/SCCP.cpp -=================================================================== ---- lib/Transforms/Scalar/SCCP.cpp -+++ lib/Transforms/Scalar/SCCP.cpp -@@ -1054,7 +1054,7 @@ - - // load null -> null - if (isa(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(Ptr)) { -Index: lib/Transforms/Utils/LoopUnrollRuntime.cpp -=================================================================== ---- lib/Transforms/Utils/LoopUnrollRuntime.cpp -+++ lib/Transforms/Utils/LoopUnrollRuntime.cpp -@@ -81,7 +81,7 @@ - if (L->contains(PN)) { - NewPN->addIncoming(PN->getIncomingValueForBlock(NewPH), OrigPH); - } else { -- NewPN->addIncoming(Constant::getNullValue(PN->getType()), OrigPH); -+ NewPN->addIncoming(UndefValue::get(PN->getType()), OrigPH); - } - - Value *V = PN->getIncomingValueForBlock(Latch); -Index: test/Transforms/LoopUnroll/X86/mmx.ll -=================================================================== ---- test/Transforms/LoopUnroll/X86/mmx.ll -+++ test/Transforms/LoopUnroll/X86/mmx.ll -@@ -0,0 +1,21 @@ -+; RUN: opt < %s -S -loop-unroll | FileCheck %s -+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -+target triple = "x86_64-unknown-linux-gnu" -+ -+define x86_mmx @f() #0 { -+entry: -+ br label %for.body -+ -+for.body: ; preds = %for.body, %entry -+ %phi = phi i32 [ 1, %entry ], [ %add, %for.body ] -+ %add = add i32 %phi, 1 -+ %cmp = icmp eq i32 %phi, 0 -+ br i1 %cmp, label %exit, label %for.body -+ -+exit: ; preds = %for.body -+ %ret = phi x86_mmx [ undef, %for.body ] -+ ; CHECK: ret x86_mmx %ret -+ ret x86_mmx %ret -+} -+ -+attributes #0 = { "target-cpu"="x86-64" } -Index: test/Transforms/SCCP/crash.ll -=================================================================== ---- test/Transforms/SCCP/crash.ll -+++ test/Transforms/SCCP/crash.ll -@@ -27,3 +27,8 @@ - %B = extractvalue [4 x i32] %A, 1 - ret i32 %B - } -+ -+define x86_mmx @test3() { -+ %load = load x86_mmx* null -+ ret x86_mmx %load -+}