Some fixes from uptream..

- Use dwarf-2 by default on OpenBSD and FreeBSD.
- Make VSELECT selection terminate in cases where the condition type has
  to be split and the result type widened.
  (fixes an OOM crash with the vectorizer on i386 if not utilizing SSE2
   or newer)
- The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a
  function that reads two __m64 values and packs four 32-bit values into
  four 16-bit values.

Fix profiling..

- Alias the command line parameter -p to -pg.

From Bitrig

ok sthen@
This commit is contained in:
brad 2014-06-13 22:29:40 +00:00
parent 12df38e70f
commit db151cc6a6
5 changed files with 99 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.74 2014/05/29 00:23:36 brad Exp $
# $OpenBSD: Makefile,v 1.75 2014/06/13 22:29:40 brad Exp $
# XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when
# updating this port.
@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compiler, static analyzer and tools
LLVM_V = 3.5
DISTNAME = llvm-${LLVM_V}.20140228
REVISION = 2
REVISION = 3
CATEGORIES = devel
MASTER_SITES = http://comstyle.com/source/
EXTRACT_SUFX = .tar.xz

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-lib_CodeGen_SelectionDAG_LegalizeVectorTypes_cpp,v 1.1 2014/06/13 22:29:40 brad Exp $
r203311
ISel: Make VSELECT selection terminate in cases where the condition type has to
be split and the result type widened.
When the condition of a vselect has to be split it makes no sense widening the
vselect and thereby widening the condition. We end up in an endless loop of
widening (vselect result type) and splitting (condition mask type) doing this.
Instead, split both the condition and the vselect and widen the result.
--- lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp.orig Thu Jun 5 00:00:32 2014
+++ lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Jun 5 00:01:21 2014
@@ -2192,6 +2192,17 @@ SDValue DAGTypeLegalizer::WidenVecRes_SELECT(SDNode *N
if (getTypeAction(CondVT) == TargetLowering::TypeWidenVector)
Cond1 = GetWidenedVector(Cond1);
+ // If we have to split the condition there is no point in widening the
+ // select. This would result in an cycle of widening the select ->
+ // widening the condition operand -> splitting the condition operand ->
+ // splitting the select -> widening the select. Instead split this select
+ // further and widen the resulting type.
+ if (getTypeAction(CondVT) == TargetLowering::TypeSplitVector) {
+ SDValue SplitSelect = SplitVecOp_VSELECT(N, 0);
+ SDValue Res = ModifyToType(SplitSelect, WidenVT);
+ return Res;
+ }
+
if (Cond1.getValueType() != CondWidenVT)
Cond1 = ModifyToType(Cond1, CondWidenVT);
}

View File

@ -1,6 +1,9 @@
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.2 2014/04/18 09:30:48 brad Exp $
--- tools/clang/include/clang/Driver/Options.td.orig Fri Jan 31 06:34:49 2014
+++ tools/clang/include/clang/Driver/Options.td Fri Jan 31 06:43:54 2014
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.3 2014/06/13 22:29:40 brad Exp $
Alias the command line parameter -p to -pg.
--- tools/clang/include/clang/Driver/Options.td.orig Sun Mar 2 22:03:58 2014
+++ tools/clang/include/clang/Driver/Options.td Thu Jun 5 00:23:11 2014
@@ -253,7 +253,7 @@ def Qn : Flag<["-"], "Qn">;
def Qunused_arguments : Flag<["-"], "Qunused-arguments">, Flags<[DriverOption, CoreOption]>,
HelpText<"Don't emit warning for unused driver arguments">;
@ -10,3 +13,12 @@ $OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.2 2014/04/18 09:
def S : Flag<["-"], "S">, Flags<[DriverOption,CC1Option]>, Group<Action_Group>,
HelpText<"Only run preprocess and compilation steps">;
def Tbss : JoinedOrSeparate<["-"], "Tbss">, Group<T_Group>;
@@ -1244,7 +1244,7 @@ def private__bundle : Flag<["-"], "private_bundle">;
def pthreads : Flag<["-"], "pthreads">;
def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>,
HelpText<"Support POSIX threads in generated code">;
-def p : Flag<["-"], "p">;
+def p : Flag<["-"], "p">, Alias<pg>;
def pie : Flag<["-"], "pie">;
def read__only__relocs : Separate<["-"], "read_only_relocs">;
def remap : Flag<["-"], "remap">;

View File

@ -1,11 +1,40 @@
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.19 2014/05/29 00:23:36 brad Exp $
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.20 2014/06/13 22:29:40 brad Exp $
r210883
Use dwarf-2 by default on OpenBSD and FreeBSD.
r209479
Don't reduce the stack protector level given -fstack-protector.
--- tools/clang/lib/Driver/Tools.cpp.orig Sun Mar 2 22:03:41 2014
+++ tools/clang/lib/Driver/Tools.cpp Thu May 22 17:52:57 2014
@@ -3197,9 +3197,10 @@ void Clang::ConstructJob(Compilation &C, const JobActi
+++ tools/clang/lib/Driver/Tools.cpp Fri Jun 13 00:15:55 2014
@@ -2696,8 +2696,10 @@ void Clang::ConstructJob(Compilation &C, const JobActi
// FIXME: we should support specifying dwarf version with
// -gline-tables-only.
CmdArgs.push_back("-gline-tables-only");
- // Default is dwarf-2 for darwin.
- if (getToolChain().getTriple().isOSDarwin())
+ // Default is dwarf-2 for Darwin, OpenBSD and FreeBSD.
+ const llvm::Triple &Triple = getToolChain().getTriple();
+ if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
+ Triple.getOS() == llvm::Triple::FreeBSD)
CmdArgs.push_back("-gdwarf-2");
} else if (A->getOption().matches(options::OPT_gdwarf_2))
CmdArgs.push_back("-gdwarf-2");
@@ -2707,8 +2709,10 @@ void Clang::ConstructJob(Compilation &C, const JobActi
CmdArgs.push_back("-gdwarf-4");
else if (!A->getOption().matches(options::OPT_g0) &&
!A->getOption().matches(options::OPT_ggdb0)) {
- // Default is dwarf-2 for darwin.
- if (getToolChain().getTriple().isOSDarwin())
+ // Default is dwarf-2 for Darwin, OpenBSD and FreeBSD.
+ const llvm::Triple &Triple = getToolChain().getTriple();
+ if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
+ Triple.getOS() == llvm::Triple::FreeBSD)
CmdArgs.push_back("-gdwarf-2");
else
CmdArgs.push_back("-g");
@@ -3197,9 +3201,10 @@ void Clang::ConstructJob(Compilation &C, const JobActi
options::OPT_fstack_protector_all,
options::OPT_fstack_protector_strong,
options::OPT_fstack_protector)) {
@ -19,7 +48,7 @@ Don't reduce the stack protector level given -fstack-protector.
StackProtectorLevel = LangOptions::SSPStrong;
else if (A->getOption().matches(options::OPT_fstack_protector_all))
StackProtectorLevel = LangOptions::SSPReq;
@@ -5743,6 +5744,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const
@@ -5743,6 +5748,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const
"/4.2.1"));
Args.AddAllArgs(CmdArgs, options::OPT_L);

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-tools_clang_lib_Headers_xmmintrin_h,v 1.1 2014/06/13 22:29:40 brad Exp $
r209489
The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a function
that reads two __m64 values and packs four 32-bit values into four 16-bit
values.
--- tools/clang/lib/Headers/xmmintrin.h.orig Thu Jun 5 00:06:01 2014
+++ tools/clang/lib/Headers/xmmintrin.h Thu Jun 5 00:06:36 2014
@@ -905,7 +905,7 @@ _mm_cvtps_pi16(__m128 __a)
__a = _mm_movehl_ps(__a, __a);
__c = _mm_cvtps_pi32(__a);
- return _mm_packs_pi16(__b, __c);
+ return _mm_packs_pi32(__b, __c);
}
static __inline__ __m64 __attribute__((__always_inline__, __nodebug__))