[llvm] 0b36431 - [NFCI] InstructionTest: trim `InstructionsTest.ShuffleMaskIsReplicationMask_*` complexity

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 09:23:15 PDT 2021


Author: Roman Lebedev
Date: 2021-11-05T19:22:48+03:00
New Revision: 0b36431810076790b1f3362495b2eaebc9be96c7

URL: https://github.com/llvm/llvm-project/commit/0b36431810076790b1f3362495b2eaebc9be96c7
DIFF: https://github.com/llvm/llvm-project/commit/0b36431810076790b1f3362495b2eaebc9be96c7.diff

LOG: [NFCI] InstructionTest: trim `InstructionsTest.ShuffleMaskIsReplicationMask_*` complexity

These tests have pretty high O() complexity due to their nature,
which leads to potentially-long runtimes.

While in release build for me they took ~1 and ~2 sec,
as noted in https://reviews.llvm.org/D113214#inline-1080479
they take minutes in debug build.

Fine-tune the amount of permutations they deal with,
without affecting the test coverage. After this,
they take <~10ms each for me (in release build),
hopefully that is good-enough for debug build too.

Added: 
    

Modified: 
    llvm/unittests/IR/InstructionsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index a60ee79acfd0..213435f4c8d3 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -1131,7 +1131,7 @@ TEST(InstructionsTest, ShuffleMaskIsReplicationMask) {
 }
 
 TEST(InstructionsTest, ShuffleMaskIsReplicationMask_undef) {
-  for (int ReplicationFactor : seq_inclusive(1, 6)) {
+  for (int ReplicationFactor : seq_inclusive(1, 4)) {
     for (int VF : seq_inclusive(1, 4)) {
       const auto ReplicatedMask = createReplicatedMask(ReplicationFactor, VF);
       int GuessedReplicationFactor = -1, GuessedVF = -1;
@@ -1165,7 +1165,7 @@ TEST(InstructionsTest, ShuffleMaskIsReplicationMask_undef) {
 }
 
 TEST(InstructionsTest, ShuffleMaskIsReplicationMask_Exhaustive_Correctness) {
-  for (int ShufMaskNumElts : seq_inclusive(1, 8)) {
+  for (int ShufMaskNumElts : seq_inclusive(1, 6)) {
     SmallVector<int> PossibleShufMaskElts;
     PossibleShufMaskElts.reserve(ShufMaskNumElts + 2);
     for (int PossibleShufMaskElt : seq_inclusive(-1, ShufMaskNumElts))


        


More information about the llvm-commits mailing list