Set REQUIRES shell on the test cases for r186044
[oota-llvm.git] / unittests / IR / ValueTest.cpp
1 //===- llvm/unittest/IR/ValueTest.cpp - Value unit tests ------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/Assembly/Parser.h"
11 #include "llvm/IR/Function.h"
12 #include "llvm/IR/LLVMContext.h"
13 #include "llvm/IR/Module.h"
14 #include "llvm/IR/Value.h"
15 #include "llvm/Support/SourceMgr.h"
16 #include "gtest/gtest.h"
17 using namespace llvm;
18
19 namespace {
20
21 TEST(ValueTest, UsedInBasicBlock) {
22   LLVMContext C;
23
24   const char *ModuleString = "define void @f(i32 %x, i32 %y) {\n"
25                              "bb0:\n"
26                              "  %y1 = add i32 %y, 1\n"
27                              "  %y2 = add i32 %y, 1\n"
28                              "  %y3 = add i32 %y, 1\n"
29                              "  %y4 = add i32 %y, 1\n"
30                              "  %y5 = add i32 %y, 1\n"
31                              "  %y6 = add i32 %y, 1\n"
32                              "  %y7 = add i32 %y, 1\n"
33                              "  %y8 = add i32 %x, 1\n"
34                              "  ret void\n"
35                              "}\n";
36   SMDiagnostic Err;
37   Module *M = ParseAssemblyString(ModuleString, NULL, Err, C);
38
39   Function *F = M->getFunction("f");
40
41   EXPECT_FALSE(F->isUsedInBasicBlock(F->begin()));
42   EXPECT_TRUE((++F->arg_begin())->isUsedInBasicBlock(F->begin()));
43   EXPECT_TRUE(F->arg_begin()->isUsedInBasicBlock(F->begin()));
44 }
45
46 } // end anonymous namespace