llvm-project/polly/lib/Support
Michael Kruse df8e140349 Remove immediate dominator heuristic for error block detection.
This patch removes the heuristic in
- Polly :: lib/Support/ScopHelper.cpp

The heuristic forces blocks that directly follow a loop header to not to be considered error blocks.
It was introduced in r249611 with the following commit message:

>   This replaces the support for user defined error functions by a
>   heuristic that tries to determine if a call to a non-pure function
>   should be considered "an error". If so the block is assumed not to be
>   executed at runtime. While treating all non-pure function calls as
>   errors will allow a lot more regions to be analyzed, it will also
>   cause us to dismiss a lot again due to an infeasible runtime context.
>   This patch tries to limit that effect. A non-pure function call is
>   considered an error if it is executed only in conditionally with
>   regards to a cheap but simple heuristic.

In the code below `CCK_Abort2()` would be considered as an error block, but not `CCK_Abort1()` due to this heuristic.
```
for (int i = 0; i < n; i+=1) {
  if (ErrorCondition1)
    CCK_Abort1(); // No __attribute__((noreturn))
  if (ErrorCondition2)
    CCK_Abort2(); // No __attribute__((noreturn))
}
```

This does not seem useful. Checking error conditions in the beginning of some work is quite common. It causes a switch default-case to be not considered an error block in SPEC's cactuBSSN. The comment justifying the heuristic mentions a "load", which does not seem to be applicable here. It has been proposed to remove the heuristic.

In addition, the patch fixes the following test cases:
- Polly :: ScopDetect/mod_ref_read_pointer.ll
- Polly :: ScopInfo/max-loop-depth.ll
- Polly :: ScopInfo/mod_ref_access_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointer.ll
- Polly :: ScopInfo/mod_ref_read_pointers.ll

The test cases failed after removing the heuristic.

Differential Revision: https://reviews.llvm.org/D45274

Contributed-by: Lorenzo Chelini <l.chelini@icloud.com>
llvm-svn: 329548
2018-04-09 06:07:44 +00:00
..
DumpModulePass.cpp [Support] Rename tool_output_file to ToolOutputFile, NFC 2017-09-23 01:03:17 +00:00
GICHelper.cpp Do not call band_list().dump() 2018-02-20 07:24:40 +00:00
ISLTools.cpp [polly] Change std::sort to llvm::sort in response to r327219 2018-03-13 05:25:23 +00:00
Mainpage.h docs: Add doxygen mainpage 2016-03-07 21:17:48 +00:00
PollyPasses.def [JSON][PM] Port json import/export over to new pm 2017-08-10 14:45:09 +00:00
RegisterPasses.cpp Add more statistics. 2017-08-23 13:50:30 +00:00
SCEVAffinator.cpp Revert untested changes in SCEVAffinator 2018-03-10 19:15:23 +00:00
SCEVValidator.cpp [ScopInfo] Allow uniform branch conditions 2017-09-25 16:37:15 +00:00
ScopHelper.cpp Remove immediate dominator heuristic for error block detection. 2018-04-09 06:07:44 +00:00
ScopLocation.cpp clang-tidy: Add llvm namespace comments 2016-06-23 22:17:27 +00:00
VirtualInstruction.cpp [VirtualInst] Derive correct use kind of PHI operands. NFC. 2018-01-23 23:56:25 +00:00