Page MenuHomePhabricator

[SLP] Don't vectorize PHIs in catchswitch blocks
ClosedPublic

Authored by wjschmidt on Jul 18 2022, 2:19 PM.

Details

Summary
We currently assert in vectorizeTree(TreeEntry*) when processing a PHI
bundle in a block containing a catchswitch.  We attempt to set the
IRBuilder insertion point following the catchswitch, which is invalid.
This is done so that ShuffleBuilder.finalize() knows where to insert
a shuffle if one is needed.

To avoid this occurring, watch out for catchswitch blocks during
buildTree_rec() processing, and avoid adding PHIs in such blocks to
the vectorizable tree.  It is unlikely that constraining vectorization
over an exception path will cause a noticeable performance loss, so
this seems preferable to trying to anticipate when a shuffle will and
will not be required.

Diff Detail

Unit TestsFailed

TimeTest
60,150 msx64 debian > AddressSanitizer-x86_64-linux-dynamic.TestCases::scariness_score_test.cpp
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -shared-libasan -O0 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/scariness_score_test.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/scariness_score_test.cpp.tmp
60,110 msx64 debian > AddressSanitizer-x86_64-linux.TestCases::scariness_score_test.cpp
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -O0 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/scariness_score_test.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/scariness_score_test.cpp.tmp
60,090 msx64 debian > Polly.ScheduleOptimizer::pattern-matching-based-opts_5.ll
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/opt -polly-process-unprofitable -polly-remarks-minimal -polly-use-llvm-names -polly-import-jscop-dir=/var/lib/buildkite-agent/builds/llvm-project/polly/test/ScheduleOptimizer -polly-codegen-verify -polly-pattern-matching-based-opts=true -polly-target-throughput-vector-fma=1 -polly-target-latency-vector-fma=8 -polly-target-1st-cache-level-associativity=8 -polly-target-2nd-cache-level-associativity=8 -polly-target-1st-cache-level-size=32768 -polly-target-vector-register-bitwidth=256 -polly-target-2nd-cache-level-size=262144 -polly-opt-isl -polly-print-ast -disable-output < /var/lib/buildkite-agent/builds/llvm-project/polly/test/ScheduleOptimizer/pattern-matching-based-opts_5.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/polly/test/ScheduleOptimizer/pattern-matching-based-opts_5.ll

Event Timeline

wjschmidt created this revision.Jul 18 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 2:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
wjschmidt requested review of this revision.Jul 18 2022, 2:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 2:19 PM
This revision is now accepted and ready to land.Jul 18 2022, 5:29 PM
wjschmidt closed this revision.Tue, Sep 20, 5:52 AM

Whoops, I forgot to reference this revision when I committed the patch. This was bccc9aa81c1c1d212acd3314895731ec4de30e35.