Skip to content

Commit ad67261

Browse files
author
Damian Rouson
committed
Merge remote-tracking branch 'sourceryinstitute/master' into teams
2 parents 1e14281 + e6b5fa1 commit ad67261

File tree

125 files changed

+4527
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4527
-287
lines changed

gcc/ChangeLog

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,153 @@
1+
2017-09-20 Sebastian Peryt <[email protected]>
2+
3+
* config.gcc: Support "knm".
4+
* config/i386/driver-i386.c (host_detect_local_cpu): Detect "knm".
5+
* config/i386/i386-c.c (ix86_target_macros_internal): Handle
6+
PROCESSOR_KNM.
7+
* config/i386/i386.c (m_KNM): Define.
8+
(processor_target_table): Add "knm".
9+
(PTA_KNM): Define.
10+
(ix86_option_override_internal): Add "knm".
11+
(ix86_issue_rate): Add PROCESSOR_KNM.
12+
(ix86_adjust_cost): Ditto.
13+
(ia32_multipass_dfa_lookahead): Ditto.
14+
(get_builtin_code_for_version): Handle PROCESSOR_KNM.
15+
(fold_builtin_cpu): Add M_INTEL_KNM.
16+
* config/i386/i386.h (processor_costs): Define TARGET_KNM.
17+
(processor_type): Add PROCESSOR_KNM.
18+
* config/i386/x86-tune.def: Add m_KNM.
19+
* doc/invoke.texi: Add knm as x86 -march=/-mtune= CPU type.
20+
21+
2017-09-20 Richard Biener <[email protected]>
22+
23+
PR tree-optimization/80213
24+
* graphite-scop-detection.c (trivially_empty_bb_p): Labels
25+
are allowed in empty BBs as well.
26+
(canonicalize_loop_closed_ssa): Also look for other complex
27+
edges.
28+
(scop_detection::get_sese): Include the loop-closed PHI block
29+
in loop SESEs.
30+
(scop_detection::merge_sese): Remove code adding extra blocks.
31+
(scop_detection::region_has_one_loop): Adjust for get_sese changes.
32+
(build_scops): Assert the final returned scop is invalid.
33+
34+
2017-09-20 Richard Biener <[email protected]>
35+
36+
PR tree-optimization/82264
37+
* tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
38+
for GIMPLE_CONDs.
39+
(vn_phi_lookup): Likewise.
40+
(vn_phi_insert): Likewise.
41+
42+
2017-09-20 Jakub Jelinek <[email protected]>
43+
44+
* dwarf2out.c (tree_add_const_value_attribute): For INTEGER_CST
45+
that fits into uhwi or shwi, add DW_AT_const_value regardless
46+
of early_dwarf without going through RTL, using add_AT_unsigned
47+
or add_AT_int.
48+
49+
* dwarf2out.c (DEBUG_LTO_DWO_INFO_SECTION): Reorder defines.
50+
(DEBUG_LTO_ABBREV_SECTION): Likewise.
51+
(DEBUG_LTO_MACINFO_SECTION): Likewise.
52+
(DEBUG_MACRO_SECTION): Likewise.
53+
(DEBUG_LTO_MACRO_SECTION): Likewise.
54+
(DEBUG_STR_DWO_SECTION): Likewise.
55+
(DEBUG_LTO_STR_DWO_SECTION): Likewise.
56+
(DEBUG_LTO_LINE_SECTION): Drop .dwo suffix from the name.
57+
(DEBUG_LTO_DWO_LINE_SECTION): Define.
58+
(DEBUG_LTO_LINE_STR_SECTION): Define.
59+
(init_sections_and_labels): Initialize debug_line_str_section
60+
variable. Initialize debug_loc_section for -gdwarf-5 to
61+
DEBUG_LOCLISTS_SECTION. Formatting fixes.
62+
63+
2017-09-20 Richard Biener <[email protected]>
64+
65+
* graphite-sese-to-poly.c (extract_affine): Properly handle
66+
POINTER_PLUS_EXPR, BIT_NOT_EXPR and conversion to signed.
67+
68+
2017-09-20 Richard Biener <[email protected]>
69+
70+
PR tree-optimization/81373
71+
* graphite-scop-detection.c (build_cross_bb_scalars_def):
72+
Force SESE live-out defs to be handled even if they are
73+
scev_analyzable_p.
74+
75+
2017-09-19 Jeff Law <[email protected]>
76+
77+
* combine-stack-adj.c (combine_stack_adjustments_for_block): Do
78+
nothing for stack adjustments with REG_STACK_CHECK.
79+
* sched-deps.c (parse_add_or_inc): Reject insns with
80+
REG_STACK_CHECK from dependency breaking.
81+
* config/i386/i386.c (pro_epilogue_adjust_stack): Return insn.
82+
(ix86_adjust_satck_and_probe_stack_clash): Add REG_STACK_NOTEs.
83+
* reg-notes.def (STACK_CHECK): New note.
84+
85+
* config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): New.
86+
(ix86_expand_prologue): Dump stack clash info as needed.
87+
Call ix86_adjust_stack_and_probe_stack_clash as needed.
88+
89+
* function.c (dump_stack_clash_frame_info): New function.
90+
* function.h (dump_stack_clash_frame_info): Prototype.
91+
(enum stack_clash_probes): New enum.
92+
93+
* config/alpha/alpha.c (alpha_expand_prologue): Also check
94+
flag_stack_clash_protection.
95+
* config/arm/arm.c (arm_compute_static_chain_stack_bytes): Likewise.
96+
(arm_expand_prologue, thumb1_expand_prologue): Likewise.
97+
(arm_frame_pointer_required): Likewise.
98+
* config/ia64/ia64.c (ia64_compute_frame_size): Likewise.
99+
(ia64_expand_prologue): Likewise.
100+
* config/mips/mips.c (mips_expand_prologue): Likewise.
101+
* config/powerpcspe/powerpcspe.c (rs6000_expand_prologue): Likewise.
102+
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
103+
(sparc_flat_expand_prologue): Likewise.
104+
* config/spu/spu.c (spu_expand_prologue): Likewise.
105+
106+
* explow.c: Include "params.h".
107+
(anti_adjust_stack_and_probe_stack_clash): New function.
108+
(get_stack_check_protect): Likewise.
109+
(compute_stack_clash_protection_loop_data): Likewise.
110+
(emit_stack_clash_protection_loop_start): Likewise.
111+
(emit_stack_clash_protection_loop_end): Likewise.
112+
(allocate_dynamic_stack_space): Use get_stack_check_protect.
113+
Use anti_adjust_stack_and_probe_stack_clash.
114+
* explow.h (compute_stack_clash_protection_loop_data): Prototype.
115+
(emit_stack_clash_protection_loop_start): Likewise.
116+
(emit_stack_clash_protection_loop_end): Likewise.
117+
* rtl.h (get_stack_check_protect): Prototype.
118+
* target.def (stack_clash_protection_final_dynamic_probe): New hook.
119+
* targhooks.c (default_stack_clash_protection_final_dynamic_probe): New.
120+
* targhooks.h (default_stack_clash_protection_final_dynamic_probe):
121+
Prototype.
122+
* doc/tm.texi.in (TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE):
123+
Add @hook.
124+
* doc/tm.texi: Rebuilt.
125+
* config/aarch64/aarch64.c (aarch64_expand_prologue): Use
126+
get_stack_check_protect.
127+
* config/alpha/alpha.c (alpha_expand_prologue): Likewise.
128+
* config/arm/arm.c (arm_expand_prologue): Likewise.
129+
(arm_frame_pointer_required): Likewise.
130+
* config/i386/i386.c (ix86_expand_prologue): Likewise.
131+
* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
132+
* config/mips/mips.c (mips_expand_prologue): Likewise.
133+
* config/powerpcspe/powerpcspe.c (rs6000_emit_prologue): Likewise.
134+
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
135+
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
136+
(sparc_flat_expand_prologue): Likewise.
137+
138+
* common.opt (-fstack-clash-protection): New option.
139+
* flag-types.h (enum stack_check_type): Note difference between
140+
-fstack-check= and -fstack-clash-protection.
141+
* params.def (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE): New PARAM.
142+
(PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL): Likewise.
143+
* toplev.c (process_options): Issue warnings/errors for cases
144+
not handled with -fstack-clash-protection.
145+
* doc/invoke.texi (-fstack-clash-protection): Document new option.
146+
(-fstack-check): Note additional problem with -fstack-check=generic.
147+
Note that -fstack-check is primarily for Ada and refer users
148+
to -fstack-clash-protection for stack-clash-protection.
149+
Document new params for stack clash protection.
150+
1151
2017-09-19 Uros Bizjak <[email protected]>
2152

3153
* config/i386/i386.c (ix86_split_long_move): Do not handle
@@ -182,8 +332,8 @@
182332

183333
2017-09-17 Daniel Santos <[email protected]>
184334

185-
config/i386/i386.c: (xlogue_layout::STUB_NAME_MAX_LEN): Increase to 20
186-
bytes.
335+
* config/i386/i386.c (xlogue_layout::STUB_NAME_MAX_LEN):
336+
Increase to 20 bytes.
187337
(xlogue_layout::s_stub_names): Add an additional size-2 diminsion.
188338
(xlogue_layout::get_stub_name): Modify to select the appropairate sse
189339
or avx version of the stub.

gcc/DATESTAMP

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20170919
1+
20170920

gcc/combine-stack-adj.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ combine_stack_adjustments_for_block (basic_block bb)
508508
continue;
509509

510510
set = single_set_for_csa (insn);
511+
if (set && find_reg_note (insn, REG_STACK_CHECK, NULL_RTX))
512+
set = NULL_RTX;
511513
if (set)
512514
{
513515
rtx dest = SET_DEST (set);

gcc/common.opt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2320,13 +2320,18 @@ Common Report Var(flag_variable_expansion_in_unroller) Optimization
23202320
Apply variable expansion when loops are unrolled.
23212321

23222322
fstack-check=
2323-
Common Report RejectNegative Joined
2323+
Common Report RejectNegative Joined Optimization
23242324
-fstack-check=[no|generic|specific] Insert stack checking code into the program.
23252325

23262326
fstack-check
23272327
Common Alias(fstack-check=, specific, no)
23282328
Insert stack checking code into the program. Same as -fstack-check=specific.
23292329

2330+
fstack-clash-protection
2331+
Common Report Var(flag_stack_clash_protection) Optimization
2332+
Insert code to probe each page of stack space as it is allocated to protect
2333+
from stack-clash style attacks.
2334+
23302335
fstack-limit
23312336
Common Var(common_deferred_options) Defer
23322337

gcc/config.gcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pentium4 pentium4m pentiumpro prescott lakemont"
623623
x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
624624
bdver3 bdver4 znver1 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \
625625
core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \
626-
sandybridge ivybridge haswell broadwell bonnell silvermont knl \
626+
sandybridge ivybridge haswell broadwell bonnell silvermont knl knm \
627627
skylake-avx512 x86-64 native"
628628

629629
# Additional x86 processors supported by --with-cpu=. Each processor

gcc/config/aarch64/aarch64.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3666,12 +3666,14 @@ aarch64_expand_prologue (void)
36663666
{
36673667
if (crtl->is_leaf && !cfun->calls_alloca)
36683668
{
3669-
if (frame_size > PROBE_INTERVAL && frame_size > STACK_CHECK_PROTECT)
3670-
aarch64_emit_probe_stack_range (STACK_CHECK_PROTECT,
3671-
frame_size - STACK_CHECK_PROTECT);
3669+
if (frame_size > PROBE_INTERVAL
3670+
&& frame_size > get_stack_check_protect ())
3671+
aarch64_emit_probe_stack_range (get_stack_check_protect (),
3672+
(frame_size
3673+
- get_stack_check_protect ()));
36723674
}
36733675
else if (frame_size > 0)
3674-
aarch64_emit_probe_stack_range (STACK_CHECK_PROTECT, frame_size);
3676+
aarch64_emit_probe_stack_range (get_stack_check_protect (), frame_size);
36753677
}
36763678

36773679
aarch64_sub_sp (IP0_REGNUM, initial_adjust, true);

gcc/config/alpha/alpha.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7760,8 +7760,8 @@ alpha_expand_prologue (void)
77607760
Note that we are only allowed to adjust sp once in the prologue. */
77617761

77627762
probed_size = frame_size;
7763-
if (flag_stack_check)
7764-
probed_size += STACK_CHECK_PROTECT;
7763+
if (flag_stack_check || flag_stack_clash_protection)
7764+
probed_size += get_stack_check_protect ();
77657765

77667766
if (probed_size <= 32768)
77677767
{
@@ -7775,7 +7775,7 @@ alpha_expand_prologue (void)
77757775
/* We only have to do this probe if we aren't saving registers or
77767776
if we are probing beyond the frame because of -fstack-check. */
77777777
if ((sa_size == 0 && probed_size > probed - 4096)
7778-
|| flag_stack_check)
7778+
|| flag_stack_check || flag_stack_clash_protection)
77797779
emit_insn (gen_probe_stack (GEN_INT (-probed_size)));
77807780
}
77817781

@@ -7805,15 +7805,16 @@ alpha_expand_prologue (void)
78057805
late in the compilation, generate the loop as a single insn. */
78067806
emit_insn (gen_prologue_stack_probe_loop (count, ptr));
78077807

7808-
if ((leftover > 4096 && sa_size == 0) || flag_stack_check)
7808+
if ((leftover > 4096 && sa_size == 0)
7809+
|| flag_stack_check || flag_stack_clash_protection)
78097810
{
78107811
rtx last = gen_rtx_MEM (DImode,
78117812
plus_constant (Pmode, ptr, -leftover));
78127813
MEM_VOLATILE_P (last) = 1;
78137814
emit_move_insn (last, const0_rtx);
78147815
}
78157816

7816-
if (flag_stack_check)
7817+
if (flag_stack_check || flag_stack_clash_protection)
78177818
{
78187819
/* If -fstack-check is specified we have to load the entire
78197820
constant into a register and subtract from the sp in one go,

gcc/config/arm/arm.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19164,7 +19164,8 @@ arm_compute_static_chain_stack_bytes (void)
1916419164
/* See the defining assertion in arm_expand_prologue. */
1916519165
if (IS_NESTED (arm_current_func_type ())
1916619166
&& ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM)
19167-
|| (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
19167+
|| ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
19168+
|| flag_stack_clash_protection)
1916819169
&& !df_regs_ever_live_p (LR_REGNUM)))
1916919170
&& arm_r3_live_at_start_p ()
1917019171
&& crtl->args.pretend_args_size == 0)
@@ -21466,7 +21467,8 @@ arm_expand_prologue (void)
2146621467
clobbered when creating the frame, we need to save and restore it. */
2146721468
clobber_ip = IS_NESTED (func_type)
2146821469
&& ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM)
21469-
|| (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
21470+
|| ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
21471+
|| flag_stack_clash_protection)
2147021472
&& !df_regs_ever_live_p (LR_REGNUM)
2147121473
&& arm_r3_live_at_start_p ()));
2147221474

@@ -21680,7 +21682,8 @@ arm_expand_prologue (void)
2168021682
stack checking. We use IP as the first scratch register, except for the
2168121683
non-APCS nested functions if LR or r3 are available (see clobber_ip). */
2168221684
if (!IS_INTERRUPT (func_type)
21683-
&& flag_stack_check == STATIC_BUILTIN_STACK_CHECK)
21685+
&& (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
21686+
|| flag_stack_clash_protection))
2168421687
{
2168521688
unsigned int regno;
2168621689

@@ -21693,13 +21696,13 @@ arm_expand_prologue (void)
2169321696

2169421697
if (crtl->is_leaf && !cfun->calls_alloca)
2169521698
{
21696-
if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT)
21697-
arm_emit_probe_stack_range (STACK_CHECK_PROTECT,
21698-
size - STACK_CHECK_PROTECT,
21699+
if (size > PROBE_INTERVAL && size > get_stack_check_protect ())
21700+
arm_emit_probe_stack_range (get_stack_check_protect (),
21701+
size - get_stack_check_protect (),
2169921702
regno, live_regs_mask);
2170021703
}
2170121704
else if (size > 0)
21702-
arm_emit_probe_stack_range (STACK_CHECK_PROTECT, size,
21705+
arm_emit_probe_stack_range (get_stack_check_protect (), size,
2170321706
regno, live_regs_mask);
2170421707
}
2170521708

@@ -24991,7 +24994,9 @@ thumb1_expand_prologue (void)
2499124994
current_function_static_stack_size = size;
2499224995

2499324996
/* If we have a frame, then do stack checking. FIXME: not implemented. */
24994-
if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK && size)
24997+
if ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
24998+
|| flag_stack_clash_protection)
24999+
&& size)
2499525000
sorry ("-fstack-check=specific for Thumb-1");
2499625001

2499725002
amount = offsets->outgoing_args - offsets->saved_regs;
@@ -27871,7 +27876,8 @@ arm_frame_pointer_required (void)
2787127876
instruction prior to the stack adjustment and this requires a frame
2787227877
pointer if we want to catch the exception using the EABI unwinder. */
2787327878
if (!IS_INTERRUPT (arm_current_func_type ())
27874-
&& flag_stack_check == STATIC_BUILTIN_STACK_CHECK
27879+
&& (flag_stack_check == STATIC_BUILTIN_STACK_CHECK
27880+
|| flag_stack_clash_protection)
2787527881
&& arm_except_unwind_info (&global_options) == UI_TARGET
2787627882
&& cfun->can_throw_non_call_exceptions)
2787727883
{
@@ -27886,7 +27892,7 @@ arm_frame_pointer_required (void)
2788627892
{
2788727893
/* We don't have the final size of the frame so adjust. */
2788827894
size += 32 * UNITS_PER_WORD;
27889-
if (size > PROBE_INTERVAL && size > STACK_CHECK_PROTECT)
27895+
if (size > PROBE_INTERVAL && size > get_stack_check_protect ())
2789027896
return true;
2789127897
}
2789227898
else

gcc/config/i386/driver-i386.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,13 +790,20 @@ const char *host_detect_local_cpu (int argc, const char **argv)
790790
/* Knights Landing. */
791791
cpu = "knl";
792792
break;
793+
case 0x85:
794+
/* Knights Mill. */
795+
cpu = "knm";
796+
break;
793797
default:
794798
if (arch)
795799
{
796800
/* This is unknown family 0x6 CPU. */
797801
/* Assume Knights Landing. */
798802
if (has_avx512f)
799803
cpu = "knl";
804+
/* Assume Knights Mill */
805+
else if (has_avx5124vnniw)
806+
cpu = "knm";
800807
/* Assume Skylake. */
801808
else if (has_clflushopt)
802809
cpu = "skylake";

gcc/config/i386/i386-c.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
176176
def_or_undef (parse_in, "__knl");
177177
def_or_undef (parse_in, "__knl__");
178178
break;
179+
case PROCESSOR_KNM:
180+
def_or_undef (parse_in, "__knm");
181+
def_or_undef (parse_in, "__knm__");
182+
break;
179183
case PROCESSOR_SKYLAKE_AVX512:
180184
def_or_undef (parse_in, "__skylake_avx512");
181185
def_or_undef (parse_in, "__skylake_avx512__");
@@ -292,6 +296,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
292296
case PROCESSOR_KNL:
293297
def_or_undef (parse_in, "__tune_knl__");
294298
break;
299+
case PROCESSOR_KNM:
300+
def_or_undef (parse_in, "__tune_knm__");
301+
break;
295302
case PROCESSOR_SKYLAKE_AVX512:
296303
def_or_undef (parse_in, "__tune_skylake_avx512__");
297304
break;

0 commit comments

Comments
 (0)