This is an archive of the discontinued LLVM Phabricator instance.

[WIP] Prototype outlined assumptions and operand bundle information attachment
Changes PlannedPublic

Authored by jdoerfert on Dec 19 2019, 1:11 AM.

Details

Summary
NOTE: This is a prototype not a finished patch!

Note: There is a mailing list discussion on this: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

This patch introduces an assumption outliner, which is probably not here to
stay but helpful in creating operand bundle annotated llvm.assumes and
outlined assumption code.

Various passes, basically all that seemed interesting and deal with
assumptions, have been updated to work with outlined assumption code to
some degree.

AlignmentFromAssumptions is used to provide an additional operand bundle
for the llvm.assume that connects the outlined code with its original
location. The operand bundle has the form

`"align"(%ptr, %alignment, %offset)`

and that is the form we should generate in the first place.
The AlignmentFromAssumptionsPass is also able to read "align" operand
bundles on llvm.assume calls.

The other passes that deal with the outlined assumptions do violate
function pass rules but it should be sufficient to test this out.

Test for a few affected passes have been modified to run the outliner
first. While there are problems, overall most transformations are sill
possible and performed already.

A path forward could be to adopt (a clean version of) the outliner for
now but only run it if we can encode the information "natively" in an
operand bundle, e.g., as described for "align" above. We then would
start to emit information in this format in the frontends and decide how
we want to deal with outlining.

Diff Detail

Event Timeline

jdoerfert created this revision.Dec 19 2019, 1:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2019, 1:11 AM
jdoerfert edited the summary of this revision. (Show Details)Dec 19 2019, 1:17 AM

Unit tests: fail. 60920 tests passed, 47 failed and 726 were skipped.

failed: LLVM-Unit.Transforms/Utils/_/UtilsTests/CodeExtractor.ExitStub
failed: LLVM-Unit.Transforms/Utils/_/UtilsTests/CodeExtractor.StoreOutputInvokeResultAfterEHPad
failed: Clang.CodeGen/align_value.cpp
failed: Clang.CodeGen/alloc-align-attr.c
failed: Clang.CodeGen/builtin-assume-aligned.c
failed: Clang.CodeGen/builtin-assume.c
failed: Clang.CodeGen/catch-alignment-assumption-attribute-align_value-on-lvalue.cpp
failed: Clang.CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
failed: Clang.CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp
failed: Clang.CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
failed: Clang.CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function.cpp
failed: Clang.CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
failed: Clang.CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp
failed: Clang.CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
failed: Clang.CodeGen/catch-alignment-assumption-openmp.cpp
failed: Clang.OpenMP/distribute_simd_codegen.cpp
failed: Clang.OpenMP/parallel_master_taskloop_simd_codegen.cpp
failed: Clang.OpenMP/simd_codegen.cpp
failed: Clang.OpenMP/simd_metadata.c
failed: Clang.OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp
failed: Clang-Unit.Frontend/_/FrontendTests/FrontendOutputTests.TestOutputStream
failed: LLVM.Other/opt-O0-pipeline.ll
failed: LLVM.Other/opt-O2-pipeline.ll
failed: LLVM.Other/opt-O3-pipeline.ll
failed: LLVM.Other/opt-Os-pipeline.ll
failed: LLVM.Other/pass-pipelines.ll
failed: LLVM.Transforms/BlockExtractor/extract-blocks-with-groups.ll
failed: LLVM.Transforms/BlockExtractor/extract-blocks.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineAnd.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineAttributes.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineDebug.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineHighCost.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineInvokeProducesOutVal.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineOrAnd.ll
failed: LLVM.Transforms/CodeExtractor/PartialInlineVarArgsDebug.ll
failed: LLVM.Transforms/CodeExtractor/X86/InheritTargetAttributes.ll
failed: LLVM.Transforms/DCE/guards.ll
failed: LLVM.Transforms/EarlyCSE/guards.ll
failed: LLVM.Transforms/HotColdSplit/duplicate-phi-preds-crash.ll
failed: LLVM.Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
failed: LLVM.Transforms/HotColdSplit/split-phis-in-exit-blocks.ll
failed: LLVM.Transforms/HotColdSplit/succ-block-with-self-edge.ll
failed: LLVM.Transforms/InstCombine/assume-redundant.ll
failed: LLVM.Transforms/InstCombine/assume.ll
failed: LLVM.Transforms/InstCombine/select.ll
failed: LLVM.Transforms/LICM/pr32129.ll
failed: LLVM.Transforms/LoopUnswitch/guards.ll

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

fhahn added a subscriber: fhahn.Dec 20 2019, 3:41 AM

With bundle patches landing, what's the status here?

jdoerfert planned changes to this revision.Apr 4 2020, 8:32 AM
jdoerfert marked an inline comment as done.

@lebedev.ri This was mostly outlining related code. While I still believe this is the right way to go, I want to focus on the operand bundle changes now and revisit this afterwards. I'll update the status so it's off your list.

llvm/include/llvm/Analysis/AssumptionCache.h
132

These are only needed for the outlining of side-effects.

lebedev.ri resigned from this revision.Jan 12 2023, 4:46 PM

This review seems to be stuck/dead, consider abandoning if no longer relevant.

rkruppe removed a subscriber: rkruppe.Jan 13 2023, 9:11 AM