| 71 | } |
| 72 | |
| 73 | TEST_F(InstructionCounterTest, Count) { |
| 74 | llvm::Module* MulAddModule = CodegenMulAdd(&context_); |
| 75 | InstructionCounter instruction_counter; |
| 76 | instruction_counter.visit(*MulAddModule); |
| 77 | instruction_counter.PrintCounters(); |
| 78 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::TOTAL_FUNCTIONS), 1); |
| 79 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::TOTAL_INSTS), 3); |
| 80 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::TERMINATOR_INSTS), 1); |
| 81 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::MEMORY_INSTS), 0); |
| 82 | |
| 83 | // Test Reset |
| 84 | instruction_counter.ResetCount(); |
| 85 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::TOTAL_FUNCTIONS), 0); |
| 86 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::TOTAL_INSTS), 0); |
| 87 | EXPECT_EQ(instruction_counter.GetCount(InstructionCounter::MEMORY_INSTS), 0); |
| 88 | } |
| 89 | |
| 90 | // IR output from CodegenGcd |
| 91 | // define i32 @gcd(i32 %x, i32 %y) { |
nothing calls this directly
no test coverage detected