forked from OSchip/llvm-project
6744efa8d8
Simplify ScopDetection::isInvariant(). Essentially deny everything that is defined within the SCoP and is not load-hoisted. The previous understanding of "invariant" has a few holes: - Expressions without side-effects with only invariant arguments, but are defined withing the SCoP's region with the exception of selects and PHIs. These should be part of the index expression derived by ScalarEvolution and not of the base pointer. - Function calls with that are !mayHaveSideEffects() (typically functions with "readnone nounwind" attributes). An example is given below. @C = external global i32 declare float* @getNextBasePtr(float*) readnone nounwind ... %ptr = call float* @getNextBasePtr(float* %A, float %B) The call might return: * %A, so %ptr aliases with it in the SCoP * %B, so %ptr aliases with it in the SCoP * @C, so %ptr aliases with it in the SCoP * a new pointer everytime it is called, such as malloc() * a pointer into the allocated block of one of the aforementioned * any of the above, at random at each call Hence and contrast to a comment in the base_pointer.ll regression test, %ptr is not necessarily the same all the time. It might also alias with anything and no AliasAnalysis can tell otherwise if the definition is external. It is hence not suitable in the role of a base pointer. The practical problem with base pointers defined in SCoP statements is that it is not available globally in the SCoP. The statement instance must be executed first before the base pointer can be used. This is no problem if the base pointer is transferred as a scalar value between statements. Uses of MemoryAccess::setNewAccessRelation may add a use of the base pointer anywhere in the array. setNewAccessRelation is used by JSONImporter, DeLICM and D28518. Indeed, BlockGenerator currently assumes that base pointers are available globally and generates invalid code for new access relation (referring to the base pointer of the original code) if not, even if the base pointer would be available in the statement. This could be fixed with some added complexity and restrictions. The ExprBuilder must lookup the local BBMap and code that call setNewAccessRelation must check whether the base pointer is available first. The code would still be incorrect in the presence of aliasing. There is the switch -polly-ignore-aliasing to explicitly allow this, but it is hardly a justification for the additional complexity. It would still be mostly useless because in most cases either getNextBasePtr() has external linkage in which case the readnone nounwind attributes cannot be derived in the translation unit itself, or is defined in the same translation unit and gets inlined. Reviewed By: grosser Differential Revision: https://reviews.llvm.org/D30695 llvm-svn: 297281 |
||
---|---|---|
.. | ||
aliasing_parametric_simple_1.ll | ||
aliasing_parametric_simple_2.ll | ||
aliasing_simple_1.ll | ||
aliasing_simple_2.ll | ||
base_pointer.ll | ||
base_pointer_is_inst_inside_invariant_1___%for.i---%exit.jscop | ||
base_pointer_load_is_inst_inside_invariant_1___%for.i---%exit.jscop | ||
base_pointer_load_setNewAccessRelation.ll | ||
base_pointer_setNewAccessRelation.ll | ||
cross_loop_non_single_exit.ll | ||
cross_loop_non_single_exit_2.ll | ||
dependency_to_phi_node_outside_of_region.ll | ||
dot-scops.ll | ||
error-block-always-executed.ll | ||
error-block-referenced-from-scop.ll | ||
expand-region-correctly-2.ll | ||
expand-region-correctly.ll | ||
index_from_unpredictable_loop.ll | ||
indvars.ll | ||
intrinsics_1.ll | ||
intrinsics_2.ll | ||
intrinsics_3.ll | ||
invalid-latch-conditions.ll | ||
invalidate_scalar_evolution.ll | ||
keep_going_expansion.ll | ||
mod_ref_read_pointer.ll | ||
more-than-one-loop.ll | ||
multidim-with-undef-size.ll | ||
multidim.ll | ||
multidim_indirect_access.ll | ||
multidim_two_accesses_different_delinearization.ll | ||
nested_loop_single_exit.ll | ||
non-affine-conditional.ll | ||
non-affine-float-compare.ll | ||
non-affine-loop-condition-dependent-access.ll | ||
non-affine-loop-condition-dependent-access_2.ll | ||
non-affine-loop-condition-dependent-access_3.ll | ||
non-affine-loop.ll | ||
non-beneficial-loops-small-trip-count.ll | ||
non-constant-add-rec-start-expr.ll | ||
non-simple-memory-accesses.ll | ||
non_affine_loop_condition.ll | ||
only-one-affine-loop.ll | ||
parametric-multiply-in-scev-2.ll | ||
parametric-multiply-in-scev.ll | ||
phi_with_multi_exiting_edges.ll | ||
profitability-large-basic-blocks.ll | ||
remove_all_children.ll | ||
report-scop-location.ll | ||
restrict-undef-size-scopdetect.ll | ||
run_time_alias_check.ll | ||
scev_remove_max.ll | ||
sequential_loops.ll | ||
simple_loop.ll | ||
simple_loop_non_single_entry.ll | ||
simple_loop_non_single_exit.ll | ||
simple_loop_non_single_exit_2.ll | ||
simple_loop_two_phi_nodes.ll | ||
simple_loop_with_param.ll | ||
simple_loop_with_param_2.ll | ||
simple_non_single_entry.ll | ||
skip_function_attribute.ll | ||
srem_with_parametric_divisor.ll | ||
statistics.ll | ||
switch-in-loop-patch.ll |