summaryrefslogtreecommitdiff
path: root/unittests/IR/ValueTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/IR/ValueTest.cpp')
-rw-r--r--unittests/IR/ValueTest.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/unittests/IR/ValueTest.cpp b/unittests/IR/ValueTest.cpp
index 0087cb2fa82c..90466b2505ec 100644
--- a/unittests/IR/ValueTest.cpp
+++ b/unittests/IR/ValueTest.cpp
@@ -112,7 +112,13 @@ TEST(ValueTest, printSlots) {
// without a slot tracker.
LLVMContext C;
- const char *ModuleString = "define void @f(i32 %x, i32 %y) {\n"
+ const char *ModuleString = "@g0 = external global %500\n"
+ "@g1 = external global %900\n"
+ "\n"
+ "%900 = type { i32, i32 }\n"
+ "%500 = type { i32 }\n"
+ "\n"
+ "define void @f(i32 %x, i32 %y) {\n"
"entry:\n"
" %0 = add i32 %y, 1\n"
" %1 = add i32 %y, 1\n"
@@ -132,6 +138,11 @@ TEST(ValueTest, printSlots) {
Instruction *I1 = &*++BB.begin();
ASSERT_TRUE(I1);
+ GlobalVariable *G0 = M->getGlobalVariable("g0");
+ ASSERT_TRUE(G0);
+ GlobalVariable *G1 = M->getGlobalVariable("g1");
+ ASSERT_TRUE(G1);
+
ModuleSlotTracker MST(M.get());
#define CHECK_PRINT(INST, STR) \
@@ -172,6 +183,8 @@ TEST(ValueTest, printSlots) {
CHECK_PRINT_AS_OPERAND(I1, false, "%1");
CHECK_PRINT_AS_OPERAND(I0, true, "i32 %0");
CHECK_PRINT_AS_OPERAND(I1, true, "i32 %1");
+ CHECK_PRINT_AS_OPERAND(G0, true, "%0* @g0");
+ CHECK_PRINT_AS_OPERAND(G1, true, "%1* @g1");
#undef CHECK_PRINT_AS_OPERAND
}