Page MenuHomePhabricator

[RISCV] CleanupVSETVLI: Add phase to remove redundant VSETVLI instructions across basic blocks

Authored by arcbbb on Apr 21 2021, 1:06 AM.



This is a rework from @fpallares's and @rogfer01's patches from BSC.

This patch removes the first VSET[I]VLI from a basic block
when its config is equal to the VL & VType of predecessors.

Authored-by: Ferran Pallarès <>
Authored-by: Roger Ferrer Ibanez <>

Diff Detail

Unit TestsFailed

2,270 msx64 debian > libarcher.races::lock-unrelated.c
Script: -- : 'RUN: at line 13'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang -fopenmp -pthread -fno-experimental-isel -g -O1 -fsanitize=thread -I /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests -I /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/runtime/src -L /mnt/disks/ssd0/agent/llvm-project/build/lib -Wl,-rpath,/mnt/disks/ssd0/agent/llvm-project/build/lib /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c -o /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp -latomic && env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1' /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/deflake.bash /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp 2>&1 | tee /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp.log | /mnt/disks/ssd0/agent/llvm-project/build/./bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c

Event Timeline

arcbbb created this revision.Apr 21 2021, 1:06 AM
arcbbb requested review of this revision.Apr 21 2021, 1:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 1:06 AM
arcbbb edited the summary of this revision. (Show Details)Apr 29 2021, 12:15 AM

I'd suggest to add some specific tests showing what this improvement is doing (in addition to the other test changes).

arcbbb updated this revision to Diff 342319.May 2 2021, 11:57 PM

address Roger's comment

i. add MIR tests.
arcbbb updated this revision to Diff 342625.May 3 2021, 8:16 PM

rebased to pass unit tests.

Sorry I haven't had time to look at this in depth yet. I'll try to get round to it soon.

arcbbb planned changes to this revision.May 5 2021, 7:42 PM

Thank you for reading this.
Because there is an alternative approach proposed by Craig,
I'll check that first and then abandon this when we are in favor of that way.

arcbbb abandoned this revision.May 21 2021, 9:22 AM

D102739 is the preferred approach.