[llvm] ef66e3d - Fix ValueTrackingTest.cpp to use pair instead of tuple
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 10:22:21 PDT 2020
Author: Juneyoung Lee
Date: 2020-07-20T02:22:02+09:00
New Revision: ef66e3d086308800d7947a385c2ae09d3f55a695
URL: https://github.com/llvm/llvm-project/commit/ef66e3d086308800d7947a385c2ae09d3f55a695
DIFF: https://github.com/llvm/llvm-project/commit/ef66e3d086308800d7947a385c2ae09d3f55a695.diff
LOG: Fix ValueTrackingTest.cpp to use pair instead of tuple
Added:
Modified:
llvm/unittests/Analysis/ValueTrackingTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index a5d6df981818..75ebe9cbf8aa 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -729,64 +729,64 @@ TEST(ValueTracking, canCreatePoisonOrUndef) {
"<4 x i32> %vx, <4 x i32> %vx2, <vscale x 4 x i32> %svx, i8* %p) {\n";
std::string AsmTail = " ret void\n}";
// (can create poison?, can create undef?, IR instruction)
- SmallVector<std::tuple<bool, bool, std::string>, 32> Data = {
- {false, false, "add i32 %x, %y"},
- {true, false, "add nsw nuw i32 %x, %y"},
- {true, false, "shl i32 %x, %y"},
- {true, false, "shl <4 x i32> %vx, %vx2"},
- {true, false, "shl nsw i32 %x, %y"},
- {true, false, "shl nsw <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
- {false, false, "shl i32 %x, 31"},
- {true, false, "shl i32 %x, 32"},
- {false, false, "shl <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
- {true, false, "shl <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 32>"},
- {true, false, "ashr i32 %x, %y"},
- {true, false, "ashr exact i32 %x, %y"},
- {false, false, "ashr i32 %x, 31"},
- {true, false, "ashr exact i32 %x, 31"},
- {false, false, "ashr <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
- {true, false, "ashr <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 32>"},
- {true, false, "ashr exact <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
- {true, false, "lshr i32 %x, %y"},
- {true, false, "lshr exact i32 %x, 31"},
- {false, false, "udiv i32 %x, %y"},
- {true, false, "udiv exact i32 %x, %y"},
- {false, false, "getelementptr i8, i8* %p, i32 %x"},
- {true, false, "getelementptr inbounds i8, i8* %p, i32 %x"},
- {true, false, "fneg nnan float %fx"},
- {false, false, "fneg float %fx"},
- {false, false, "fadd float %fx, %fy"},
- {true, false, "fadd nnan float %fx, %fy"},
- {false, false, "urem i32 %x, %y"},
- {true, false, "fptoui float %fx to i32"},
- {true, false, "fptosi float %fx to i32"},
- {false, false, "bitcast float %fx to i32"},
- {false, false, "select i1 %cond, i32 %x, i32 %y"},
- {true, false, "select nnan i1 %cond, float %fx, float %fy"},
- {true, false, "extractelement <4 x i32> %vx, i32 %x"},
- {false, false, "extractelement <4 x i32> %vx, i32 3"},
- {true, false, "extractelement <vscale x 4 x i32> %svx, i32 4"},
- {true, false, "insertelement <4 x i32> %vx, i32 %x, i32 %y"},
- {false, false, "insertelement <4 x i32> %vx, i32 %x, i32 3"},
- {true, false, "insertelement <vscale x 4 x i32> %svx, i32 %x, i32 4"},
- {false, false, "freeze i32 %x"},
- {false, false,
+ SmallVector<std::pair<std::pair<bool, bool>, std::string>, 32> Data = {
+ {{false, false}, "add i32 %x, %y"},
+ {{true, false}, "add nsw nuw i32 %x, %y"},
+ {{true, false}, "shl i32 %x, %y"},
+ {{true, false}, "shl <4 x i32> %vx, %vx2"},
+ {{true, false}, "shl nsw i32 %x, %y"},
+ {{true, false}, "shl nsw <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
+ {{false, false}, "shl i32 %x, 31"},
+ {{true, false}, "shl i32 %x, 32"},
+ {{false, false}, "shl <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
+ {{true, false}, "shl <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 32>"},
+ {{true, false}, "ashr i32 %x, %y"},
+ {{true, false}, "ashr exact i32 %x, %y"},
+ {{false, false}, "ashr i32 %x, 31"},
+ {{true, false}, "ashr exact i32 %x, 31"},
+ {{false, false}, "ashr <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
+ {{true, false}, "ashr <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 32>"},
+ {{true, false}, "ashr exact <4 x i32> %vx, <i32 0, i32 1, i32 2, i32 3>"},
+ {{true, false}, "lshr i32 %x, %y"},
+ {{true, false}, "lshr exact i32 %x, 31"},
+ {{false, false}, "udiv i32 %x, %y"},
+ {{true, false}, "udiv exact i32 %x, %y"},
+ {{false, false}, "getelementptr i8, i8* %p, i32 %x"},
+ {{true, false}, "getelementptr inbounds i8, i8* %p, i32 %x"},
+ {{true, false}, "fneg nnan float %fx"},
+ {{false, false}, "fneg float %fx"},
+ {{false, false}, "fadd float %fx, %fy"},
+ {{true, false}, "fadd nnan float %fx, %fy"},
+ {{false, false}, "urem i32 %x, %y"},
+ {{true, false}, "fptoui float %fx to i32"},
+ {{true, false}, "fptosi float %fx to i32"},
+ {{false, false}, "bitcast float %fx to i32"},
+ {{false, false}, "select i1 %cond, i32 %x, i32 %y"},
+ {{true, false}, "select nnan i1 %cond, float %fx, float %fy"},
+ {{true, false}, "extractelement <4 x i32> %vx, i32 %x"},
+ {{false, false}, "extractelement <4 x i32> %vx, i32 3"},
+ {{true, false}, "extractelement <vscale x 4 x i32> %svx, i32 4"},
+ {{true, false}, "insertelement <4 x i32> %vx, i32 %x, i32 %y"},
+ {{false, false}, "insertelement <4 x i32> %vx, i32 %x, i32 3"},
+ {{true, false}, "insertelement <vscale x 4 x i32> %svx, i32 %x, i32 4"},
+ {{false, false}, "freeze i32 %x"},
+ {{false, false},
"shufflevector <4 x i32> %vx, <4 x i32> %vx2, "
"<4 x i32> <i32 0, i32 1, i32 2, i32 3>"},
- {false, true,
+ {{false, true},
"shufflevector <4 x i32> %vx, <4 x i32> %vx2, "
"<4 x i32> <i32 0, i32 1, i32 2, i32 undef>"},
- {false, true,
+ {{false, true},
"shufflevector <vscale x 4 x i32> %svx, "
"<vscale x 4 x i32> %svx, <vscale x 4 x i32> undef"},
- {true, false, "call i32 @g(i32 %x)"},
- {false, false, "call noundef i32 @g(i32 %x)"},
- {true, false, "fcmp nnan oeq float %fx, %fy"},
- {false, false, "fcmp oeq float %fx, %fy"}};
+ {{true, false}, "call i32 @g(i32 %x)"},
+ {{false, false}, "call noundef i32 @g(i32 %x)"},
+ {{true, false}, "fcmp nnan oeq float %fx, %fy"},
+ {{false, false}, "fcmp oeq float %fx, %fy"}};
std::string AssemblyStr = AsmHead;
for (auto &Itm : Data)
- AssemblyStr += std::get<2>(Itm) + "\n";
+ AssemblyStr += Itm.second + "\n";
AssemblyStr += AsmTail;
LLVMContext Context;
@@ -803,8 +803,8 @@ TEST(ValueTracking, canCreatePoisonOrUndef) {
for (auto &I : BB) {
if (isa<ReturnInst>(&I))
break;
- bool Poison = std::get<0>(Data[Index]);
- bool Undef = std::get<1>(Data[Index]);
+ bool Poison = Data[Index].first.first;
+ bool Undef = Data[Index].first.second;
EXPECT_EQ(canCreatePoison(cast<Operator>(&I)), Poison)
<< "Incorrect answer of canCreatePoison at instruction " << Index
<< " = " << I;
More information about the llvm-commits
mailing list