Josh Mottley ce8022faa3 [flang] Upstream partial lowering of EXIT intrinsic
This patch adds partial lowering of the "EXIT" intrinsic to
the backend runtime hook implemented in patch D110741. It also adds a
helper function to the `RuntimeCallTestBase.h` for testing for an
intrinsic function call in a `mlir::Block`.

Differential Revision: https://reviews.llvm.org/D118141
2022-02-01 17:48:51 +00:00

21 lines
839 B
C++

//===- StopTest.cpp -- Stop runtime builder unit tests ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "flang/Optimizer/Builder/Runtime/Stop.h"
#include "RuntimeCallTestBase.h"
#include "gtest/gtest.h"
TEST_F(RuntimeCallTest, genExitTest) {
mlir::Location loc = firBuilder->getUnknownLoc();
mlir::Value status = firBuilder->createIntegerConstant(loc, i32Ty, 0);
fir::runtime::genExit(*firBuilder, loc, status);
mlir::Block *block = firBuilder->getBlock();
EXPECT_TRUE(block) << "Failed to retrieve the block!";
checkBlockForCallOp(block, "_FortranAExit", 1);
}