llvm-capstone/polly/lib
Michael Kruse 95ef556bd1 [Polly] Preserve DetectionContext references.
DetectionContext objects are stored as values in a DenseMap. When the
DenseMap reaches its maximum load factor, it is resized and all its
objects moved to a new memory allocation. Unfortunately Scop object have
a reference to its DetectionContext. When the DenseMap resizes, all the
DetectionContexts reference now point to invalid memory, even if caused
by an unrelated DetectionContext.

Even worse, NewPM's ScopPassManager called isMaxRegionInScop with the
Verify=true parameter before each pass. This caused the old
DetectionContext to be removed an a new on created and re-verified.
Of course, the Scop object was already created pointing to the old
DetectionContext. Because the new DetectionContext would
usually be stored at the same position in the DenseMap, the reference
would usually reference the new DetectionContext of the same Region.
Usually.
If not, the old position still points to memory in the DenseMap
allocation (unless also a resizing occurs) such that tools like Valgrind
and AddressSanitizer would not be able to diagnose this.

Instead of storing the DetectionContext inside the DenseMap, use a
std::unique_ptr to a DetectionContext allocation, i.e. it will not move
around anymore. This also allows use to remove the very strange

    DetectionContext(const DetectionContext &&)

copy/move(?) constructor. DetectionContext objects now are neither
copied nor moved.

As a result, every re-verification of a DetectionContext will use a new
allocation. Therefore, once a Scop object has been created using a
DetectionContext, it must not be re-verified (the Scop data structure
requires its underlying Region to not change before code generation
anyway). The NewPM may call isMaxRegionInScop only with
Validate=false parameter.
2021-02-13 03:36:09 -06:00
..
Analysis [Polly] Preserve DetectionContext references. 2021-02-13 03:36:09 -06:00
CodeGen [Polly] Avoid "using namespace llvm" in public headers. NFC. 2021-02-10 20:58:33 -06:00
Exchange [Polly] Silence mixed signed/unsigned comparison warnings. NFC. 2020-02-10 19:03:08 -06:00
External [Polly] Update isl to isl-0.23-61-g24e8cd12. 2021-01-19 12:01:31 -06:00
Plugin Generalize the pass registration mechanism used by Polly to any third-party tool 2020-01-02 16:45:31 +01:00
Support [Polly] Sanitize optimization levels. 2021-02-11 23:07:48 -06:00
Transform [Polly] Remove unused declaration. NFC. 2021-02-12 02:20:31 -06:00
CMakeLists.txt [Windows][Polly] Disable LLVMPolly module for all compilers on Windows 2020-09-15 09:12:38 +03:00