From owner-svn-src-head@freebsd.org Sat Jul 4 20:09:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7850E93C0; Sat, 4 Jul 2015 20:09:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68D6D1A83; Sat, 4 Jul 2015 20:09:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t64K9PbB000630; Sat, 4 Jul 2015 20:09:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t64K9PGx000629; Sat, 4 Jul 2015 20:09:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507042009.t64K9PGx000629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 4 Jul 2015 20:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285150 - head/contrib/llvm/patches X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2015 20:09:25 -0000 Author: dim Date: Sat Jul 4 20:09:24 2015 New Revision: 285150 URL: https://svnweb.freebsd.org/changeset/base/285150 Log: Add llvm patch corresponding to r285149. Added: head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff Added: head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff Sat Jul 4 20:09:24 2015 (r285150) @@ -0,0 +1,88 @@ +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 ++}