[llvm] [SandboxIR] Functions to find vectorizor-relevant properties (PR #109221)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 16:54:58 PDT 2024
https://github.com/Sterling-Augustine updated https://github.com/llvm/llvm-project/pull/109221
>From 6ae7ad9ad77da43002e03a75a45ec383653d4983 Mon Sep 17 00:00:00 2001
From: Sterling Augustine <saugustine at google.com>
Date: Wed, 18 Sep 2024 16:46:11 -0700
Subject: [PATCH 1/3] [SandboxIR] Functions to find vectorizor-relevant
instruction properties.
When vectorizing, the destintation type and value of stores is more
relevant than the type of the instruction itself. Similarly for return
instructions. These functions provide a convenient way to do that
without special-casing them everywhere, and avoids the need for
friending any class that needs access to Value::LLVMTy to calculate it.
Open to better naming.
---
llvm/include/llvm/SandboxIR/SandboxIR.h | 10 +++++++
llvm/lib/SandboxIR/SandboxIR.cpp | 20 +++++++++++++
llvm/unittests/SandboxIR/SandboxIRTest.cpp | 34 ++++++++++++++++++++++
3 files changed, 64 insertions(+)
diff --git a/llvm/include/llvm/SandboxIR/SandboxIR.h b/llvm/include/llvm/SandboxIR/SandboxIR.h
index 2fdbbbd094650f..4772f95a900dd1 100644
--- a/llvm/include/llvm/SandboxIR/SandboxIR.h
+++ b/llvm/include/llvm/SandboxIR/SandboxIR.h
@@ -411,6 +411,11 @@ class Value {
Type *getType() const;
+ /// \Returns the expected type of \p V. For most Values this is equivalent
+ /// to getType, but for stores returns the stored type, rather than void,
+ /// and for ReturnInsts returns the returned type.
+ Type *getExpectedType() const;
+
Context &getContext() const { return Ctx; }
void replaceUsesWithIf(Value *OtherV,
@@ -1422,6 +1427,11 @@ class Instruction : public sandboxir::User {
/// LangRef.html for the meaning of these flags.
void copyFastMathFlags(FastMathFlags FMF);
+ /// \Returns the expected Value for this instruction. For most instructions,
+ /// this is the instruction it self, but for stores returns the stored
+ /// operand, and for ReturnInstructions returns the returned value.
+ Value *getExpectedValue() const;
+
#ifndef NDEBUG
void dumpOS(raw_ostream &OS) const override;
#endif
diff --git a/llvm/lib/SandboxIR/SandboxIR.cpp b/llvm/lib/SandboxIR/SandboxIR.cpp
index 18fdcda15a1a91..8852aba7318d35 100644
--- a/llvm/lib/SandboxIR/SandboxIR.cpp
+++ b/llvm/lib/SandboxIR/SandboxIR.cpp
@@ -137,6 +137,18 @@ unsigned Value::getNumUses() const { return range_size(Val->users()); }
Type *Value::getType() const { return Ctx.getType(Val->getType()); }
+Type *Value::getExpectedType() const {
+ if (auto *I = dyn_cast<sandboxir::Instruction>(this)) {
+ // A Return's value operand can be null if it returns void.
+ if (auto *RI = dyn_cast<sandboxir::ReturnInst>(I)) {
+ if (RI->getReturnValue() == nullptr)
+ return RI->getType();
+ }
+ return I->getExpectedValue()->getType();
+ }
+ return getType();
+}
+
void Value::replaceUsesWithIf(
Value *OtherV, llvm::function_ref<bool(const Use &)> ShouldReplace) {
assert(getType() == OtherV->getType() && "Can't replace with different type");
@@ -571,6 +583,14 @@ void Instruction::setHasApproxFunc(bool B) {
cast<llvm::Instruction>(Val)->setHasApproxFunc(B);
}
+llvm::sandboxir::Value *Instruction::getExpectedValue() const {
+ if (auto *SI = dyn_cast<StoreInst>(this))
+ return SI->getValueOperand();
+ if (auto *RI = dyn_cast<ReturnInst>(this))
+ return RI->getReturnValue();
+ return const_cast<Instruction *>(this);
+}
+
#ifndef NDEBUG
void Instruction::dumpOS(raw_ostream &OS) const {
OS << "Unimplemented! Please override dump().";
diff --git a/llvm/unittests/SandboxIR/SandboxIRTest.cpp b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
index b76d24dc297b96..055b09eed61d5c 100644
--- a/llvm/unittests/SandboxIR/SandboxIRTest.cpp
+++ b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
@@ -875,6 +875,8 @@ OperandNo: 0
EXPECT_TRUE(I0->hasNUses(1u));
EXPECT_FALSE(I0->hasNUses(2u));
+ // Check Value.getExpectedType
+
// Check User.setOperand().
Ret->setOperand(0, Arg0);
EXPECT_EQ(Ret->getOperand(0), Arg0);
@@ -947,6 +949,38 @@ define i32 @foo(i32 %arg0, i32 %arg1) {
EXPECT_EQ(Glob0->getOperand(0), Glob1);
}
+TEST_F(SandboxIRTest, GetExpected) {
+ parseIR(C, R"IR(
+define float @foo(float %v, ptr %ptr) {
+ %add = fadd float %v, %v
+ store float %v, ptr %ptr
+ ret float %v
+}
+)IR");
+ llvm::Function &LLVMF = *M->getFunction("foo");
+ sandboxir::Context Ctx(C);
+ llvm::BasicBlock *LLVMBB = &*LLVMF.begin();
+
+ Ctx.createFunction(&LLVMF);
+ auto *BB = cast<sandboxir::BasicBlock>(Ctx.getValue(LLVMBB));
+ auto It = BB->begin();
+ auto Add = cast<sandboxir::Instruction>(&*It++);
+ auto *S0 = cast<sandboxir::Instruction>(&*It++);
+ auto *Ret = cast<sandboxir::Instruction>(&*It++);
+ // Instruction.getExpectedValue
+ EXPECT_EQ(Add->getExpectedValue(), Add);
+ EXPECT_EQ(S0->getExpectedValue(),
+ cast<sandboxir::StoreInst>(S0)->getValueOperand());
+ EXPECT_EQ(Ret->getExpectedValue(),
+ cast<sandboxir::ReturnInst>(Ret)->getReturnValue());
+ // Value.getExpectedType
+ EXPECT_EQ(Add->getExpectedType(), Add->getType());
+ EXPECT_EQ(S0->getExpectedType(),
+ cast<sandboxir::StoreInst>(S0)->getValueOperand()->getType());
+ EXPECT_EQ(Ret->getExpectedType(),
+ cast<sandboxir::ReturnInst>(Ret)->getReturnValue()->getType());
+}
+
TEST_F(SandboxIRTest, RAUW_RUWIf) {
parseIR(C, R"IR(
define void @foo(ptr %ptr) {
>From a744eb0c5caa6b33c8f937659219c53acaf1e274 Mon Sep 17 00:00:00 2001
From: Sterling Augustine <saugustine at google.com>
Date: Thu, 19 Sep 2024 14:47:55 -0700
Subject: [PATCH 2/3] Move getExpectedType and getExpectedValue to a new
utility class.
Add getNumBits.
---
llvm/include/llvm/SandboxIR/SandboxIR.h | 46 +++++++++++----
llvm/include/llvm/SandboxIR/Type.h | 3 +-
llvm/lib/SandboxIR/SandboxIR.cpp | 20 -------
llvm/unittests/SandboxIR/SandboxIRTest.cpp | 67 ++++++++++++++++------
4 files changed, 87 insertions(+), 49 deletions(-)
diff --git a/llvm/include/llvm/SandboxIR/SandboxIR.h b/llvm/include/llvm/SandboxIR/SandboxIR.h
index 4772f95a900dd1..12f4aaf5b2822d 100644
--- a/llvm/include/llvm/SandboxIR/SandboxIR.h
+++ b/llvm/include/llvm/SandboxIR/SandboxIR.h
@@ -411,11 +411,6 @@ class Value {
Type *getType() const;
- /// \Returns the expected type of \p V. For most Values this is equivalent
- /// to getType, but for stores returns the stored type, rather than void,
- /// and for ReturnInsts returns the returned type.
- Type *getExpectedType() const;
-
Context &getContext() const { return Ctx; }
void replaceUsesWithIf(Value *OtherV,
@@ -1427,11 +1422,6 @@ class Instruction : public sandboxir::User {
/// LangRef.html for the meaning of these flags.
void copyFastMathFlags(FastMathFlags FMF);
- /// \Returns the expected Value for this instruction. For most instructions,
- /// this is the instruction it self, but for stores returns the stored
- /// operand, and for ReturnInstructions returns the returned value.
- Value *getExpectedValue() const;
-
#ifndef NDEBUG
void dumpOS(raw_ostream &OS) const override;
#endif
@@ -4029,6 +4019,42 @@ class Function : public Constant {
#endif
};
+// Collector for SandboxIR related convenience functions that don't belong in
+// other classes.
+class SandboxIRUtils {
+public:
+ /// \Returns the expected type of \p Value V. For most Values this is
+ /// equivalent to getType, but for stores returns the stored type, rather
+ /// than void, and for ReturnInsts returns the returned type.
+ static Type *getExpectedType(const Value *V) {
+ if (auto *I = dyn_cast<Instruction>(V)) {
+ // A Return's value operand can be null if it returns void.
+ if (auto *RI = dyn_cast<ReturnInst>(I)) {
+ if (RI->getReturnValue() == nullptr)
+ return RI->getType();
+ }
+ return getExpectedValue(I)->getType();
+ }
+ return V->getType();
+ }
+
+ /// \Returns the expected Value for this instruction. For most instructions,
+ /// this is the instruction it self, but for stores returns the stored
+ /// operand, and for ReturnInstructions returns the returned value.
+ static Value *getExpectedValue(const Instruction *I) {
+ if (auto *SI = dyn_cast<StoreInst>(I))
+ return SI->getValueOperand();
+ if (auto *RI = dyn_cast<ReturnInst>(I))
+ return RI->getReturnValue();
+ return const_cast<Instruction *>(I);
+ }
+
+ /// \Returns the number of bits required to represent \p SBV in \p DL.
+ static unsigned getNumBits(sandboxir::Value *SBV, const DataLayout &DL) {
+ Type *Ty = getExpectedType(SBV);
+ return DL.getTypeSizeInBits(Ty->LLVMTy);
+ }
+};
} // namespace sandboxir
} // namespace llvm
diff --git a/llvm/include/llvm/SandboxIR/Type.h b/llvm/include/llvm/SandboxIR/Type.h
index ec141c249fb21e..87f857bedb4d77 100644
--- a/llvm/include/llvm/SandboxIR/Type.h
+++ b/llvm/include/llvm/SandboxIR/Type.h
@@ -54,12 +54,13 @@ class Type {
friend class ConstantVector; // For LLVMTy.
friend class CmpInst; // For LLVMTy. TODO: Cleanup after
// sandboxir::VectorType is more complete.
+ friend class SandboxIRUtils; // for LLVMTy
// Friend all instruction classes because `create()` functions use LLVMTy.
#define DEF_INSTR(ID, OPCODE, CLASS) friend class CLASS;
#define DEF_CONST(ID, CLASS) friend class CLASS;
#include "llvm/SandboxIR/SandboxIRValues.def"
- Context &Ctx;
+ Context &Ctx;
Type(llvm::Type *LLVMTy, Context &Ctx) : LLVMTy(LLVMTy), Ctx(Ctx) {}
friend class Context; // For constructor and ~Type().
diff --git a/llvm/lib/SandboxIR/SandboxIR.cpp b/llvm/lib/SandboxIR/SandboxIR.cpp
index 8852aba7318d35..18fdcda15a1a91 100644
--- a/llvm/lib/SandboxIR/SandboxIR.cpp
+++ b/llvm/lib/SandboxIR/SandboxIR.cpp
@@ -137,18 +137,6 @@ unsigned Value::getNumUses() const { return range_size(Val->users()); }
Type *Value::getType() const { return Ctx.getType(Val->getType()); }
-Type *Value::getExpectedType() const {
- if (auto *I = dyn_cast<sandboxir::Instruction>(this)) {
- // A Return's value operand can be null if it returns void.
- if (auto *RI = dyn_cast<sandboxir::ReturnInst>(I)) {
- if (RI->getReturnValue() == nullptr)
- return RI->getType();
- }
- return I->getExpectedValue()->getType();
- }
- return getType();
-}
-
void Value::replaceUsesWithIf(
Value *OtherV, llvm::function_ref<bool(const Use &)> ShouldReplace) {
assert(getType() == OtherV->getType() && "Can't replace with different type");
@@ -583,14 +571,6 @@ void Instruction::setHasApproxFunc(bool B) {
cast<llvm::Instruction>(Val)->setHasApproxFunc(B);
}
-llvm::sandboxir::Value *Instruction::getExpectedValue() const {
- if (auto *SI = dyn_cast<StoreInst>(this))
- return SI->getValueOperand();
- if (auto *RI = dyn_cast<ReturnInst>(this))
- return RI->getReturnValue();
- return const_cast<Instruction *>(this);
-}
-
#ifndef NDEBUG
void Instruction::dumpOS(raw_ostream &OS) const {
OS << "Unimplemented! Please override dump().";
diff --git a/llvm/unittests/SandboxIR/SandboxIRTest.cpp b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
index 055b09eed61d5c..43bb8e5d19ec48 100644
--- a/llvm/unittests/SandboxIR/SandboxIRTest.cpp
+++ b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
@@ -956,29 +956,60 @@ define float @foo(float %v, ptr %ptr) {
store float %v, ptr %ptr
ret float %v
}
+define void @bar(float %v, ptr %ptr) {
+ ret void
+}
)IR");
- llvm::Function &LLVMF = *M->getFunction("foo");
+ llvm::Function &Foo = *M->getFunction("foo");
sandboxir::Context Ctx(C);
- llvm::BasicBlock *LLVMBB = &*LLVMF.begin();
- Ctx.createFunction(&LLVMF);
- auto *BB = cast<sandboxir::BasicBlock>(Ctx.getValue(LLVMBB));
- auto It = BB->begin();
- auto Add = cast<sandboxir::Instruction>(&*It++);
- auto *S0 = cast<sandboxir::Instruction>(&*It++);
- auto *Ret = cast<sandboxir::Instruction>(&*It++);
- // Instruction.getExpectedValue
- EXPECT_EQ(Add->getExpectedValue(), Add);
- EXPECT_EQ(S0->getExpectedValue(),
+ Ctx.createFunction(&Foo);
+ auto *FooBB = cast<sandboxir::BasicBlock>(Ctx.getValue(&*Foo.begin()));
+ auto FooIt = FooBB->begin();
+ auto Add = cast<sandboxir::Instruction>(&*FooIt++);
+ auto *S0 = cast<sandboxir::Instruction>(&*FooIt++);
+ auto *RetF = cast<sandboxir::Instruction>(&*FooIt++);
+ // getExpectedValue
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(Add), Add);
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(S0),
cast<sandboxir::StoreInst>(S0)->getValueOperand());
- EXPECT_EQ(Ret->getExpectedValue(),
- cast<sandboxir::ReturnInst>(Ret)->getReturnValue());
- // Value.getExpectedType
- EXPECT_EQ(Add->getExpectedType(), Add->getType());
- EXPECT_EQ(S0->getExpectedType(),
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(RetF),
+ cast<sandboxir::ReturnInst>(RetF)->getReturnValue());
+ // getExpectedType
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(Add), Add->getType());
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(S0),
cast<sandboxir::StoreInst>(S0)->getValueOperand()->getType());
- EXPECT_EQ(Ret->getExpectedType(),
- cast<sandboxir::ReturnInst>(Ret)->getReturnValue()->getType());
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(RetF),
+ cast<sandboxir::ReturnInst>(RetF)->getReturnValue()->getType());
+
+ // getExpectedValue for void returns
+ llvm::Function &Bar = *M->getFunction("bar");
+ Ctx.createFunction(&Bar);
+ auto *BarBB = cast<sandboxir::BasicBlock>(Ctx.getValue(&*Bar.begin()));
+ auto BarIt = BarBB->begin();
+ auto *RetV = cast<sandboxir::Instruction>(&*BarIt++);
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(RetV), nullptr);
+}
+
+TEST_F(SandboxIRTest, GetNumBits) {
+ parseIR(C, R"IR(
+define void @foo(float %arg0, double %arg1, i8 %arg2, i64 %arg34) {
+bb0:
+ ret void
+}
+)IR");
+ llvm::Function &Foo = *M->getFunction("foo");
+ sandboxir::Context Ctx(C);
+ sandboxir::Function *F = Ctx.createFunction(&Foo);
+ const DataLayout &DL = M->getDataLayout();
+ // getNumBits for scalars
+ // float
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(0), DL),
+ DL.getTypeSizeInBits(Type::getFloatTy(C)));
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(1), DL),
+ DL.getTypeSizeInBits(Type::getDoubleTy(C)));
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(2), DL), 8u);
+ EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(3), DL), 64u);
}
TEST_F(SandboxIRTest, RAUW_RUWIf) {
>From 546d2bf2f9b513d07fdc758e3179bac91af7fd3e Mon Sep 17 00:00:00 2001
From: Sterling Augustine <saugustine at google.com>
Date: Thu, 19 Sep 2024 16:54:16 -0700
Subject: [PATCH 3/3] Move to a separate header and address comments.
---
llvm/include/llvm/SandboxIR/SandboxIR.h | 37 ----------------------
llvm/include/llvm/SandboxIR/Type.h | 2 +-
llvm/unittests/SandboxIR/SandboxIRTest.cpp | 24 +++++++-------
3 files changed, 13 insertions(+), 50 deletions(-)
diff --git a/llvm/include/llvm/SandboxIR/SandboxIR.h b/llvm/include/llvm/SandboxIR/SandboxIR.h
index 12f4aaf5b2822d..143d4b40bc964f 100644
--- a/llvm/include/llvm/SandboxIR/SandboxIR.h
+++ b/llvm/include/llvm/SandboxIR/SandboxIR.h
@@ -4018,43 +4018,6 @@ class Function : public Constant {
void dumpOS(raw_ostream &OS) const final;
#endif
};
-
-// Collector for SandboxIR related convenience functions that don't belong in
-// other classes.
-class SandboxIRUtils {
-public:
- /// \Returns the expected type of \p Value V. For most Values this is
- /// equivalent to getType, but for stores returns the stored type, rather
- /// than void, and for ReturnInsts returns the returned type.
- static Type *getExpectedType(const Value *V) {
- if (auto *I = dyn_cast<Instruction>(V)) {
- // A Return's value operand can be null if it returns void.
- if (auto *RI = dyn_cast<ReturnInst>(I)) {
- if (RI->getReturnValue() == nullptr)
- return RI->getType();
- }
- return getExpectedValue(I)->getType();
- }
- return V->getType();
- }
-
- /// \Returns the expected Value for this instruction. For most instructions,
- /// this is the instruction it self, but for stores returns the stored
- /// operand, and for ReturnInstructions returns the returned value.
- static Value *getExpectedValue(const Instruction *I) {
- if (auto *SI = dyn_cast<StoreInst>(I))
- return SI->getValueOperand();
- if (auto *RI = dyn_cast<ReturnInst>(I))
- return RI->getReturnValue();
- return const_cast<Instruction *>(I);
- }
-
- /// \Returns the number of bits required to represent \p SBV in \p DL.
- static unsigned getNumBits(sandboxir::Value *SBV, const DataLayout &DL) {
- Type *Ty = getExpectedType(SBV);
- return DL.getTypeSizeInBits(Ty->LLVMTy);
- }
-};
} // namespace sandboxir
} // namespace llvm
diff --git a/llvm/include/llvm/SandboxIR/Type.h b/llvm/include/llvm/SandboxIR/Type.h
index 87f857bedb4d77..75bef833066894 100644
--- a/llvm/include/llvm/SandboxIR/Type.h
+++ b/llvm/include/llvm/SandboxIR/Type.h
@@ -54,7 +54,7 @@ class Type {
friend class ConstantVector; // For LLVMTy.
friend class CmpInst; // For LLVMTy. TODO: Cleanup after
// sandboxir::VectorType is more complete.
- friend class SandboxIRUtils; // for LLVMTy
+ friend class Utils; // for LLVMTy
// Friend all instruction classes because `create()` functions use LLVMTy.
#define DEF_INSTR(ID, OPCODE, CLASS) friend class CLASS;
diff --git a/llvm/unittests/SandboxIR/SandboxIRTest.cpp b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
index 43bb8e5d19ec48..b97084069eefba 100644
--- a/llvm/unittests/SandboxIR/SandboxIRTest.cpp
+++ b/llvm/unittests/SandboxIR/SandboxIRTest.cpp
@@ -14,6 +14,7 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Module.h"
+#include "llvm/SandboxIR/Utils.h"
#include "llvm/Support/SourceMgr.h"
#include "gmock/gmock-matchers.h"
#include "gtest/gtest.h"
@@ -940,7 +941,6 @@ define i32 @foo(i32 %arg0, i32 %arg1) {
Replaced = Ret->replaceUsesOfWith(I0, Arg0);
EXPECT_TRUE(Replaced);
EXPECT_EQ(Ret->getOperand(0), Arg0);
-
// Check RAUW on constant.
auto *Glob0 = cast<sandboxir::Constant>(I1->getOperand(0));
auto *Glob1 = cast<sandboxir::Constant>(I2->getOperand(0));
@@ -970,16 +970,16 @@ define void @bar(float %v, ptr %ptr) {
auto *S0 = cast<sandboxir::Instruction>(&*FooIt++);
auto *RetF = cast<sandboxir::Instruction>(&*FooIt++);
// getExpectedValue
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(Add), Add);
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(S0),
+ EXPECT_EQ(sandboxir::Utils::getExpectedValue(Add), Add);
+ EXPECT_EQ(sandboxir::Utils::getExpectedValue(S0),
cast<sandboxir::StoreInst>(S0)->getValueOperand());
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(RetF),
+ EXPECT_EQ(sandboxir::Utils::getExpectedValue(RetF),
cast<sandboxir::ReturnInst>(RetF)->getReturnValue());
// getExpectedType
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(Add), Add->getType());
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(S0),
+ EXPECT_EQ(sandboxir::Utils::getExpectedType(Add), Add->getType());
+ EXPECT_EQ(sandboxir::Utils::getExpectedType(S0),
cast<sandboxir::StoreInst>(S0)->getValueOperand()->getType());
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedType(RetF),
+ EXPECT_EQ(sandboxir::Utils::getExpectedType(RetF),
cast<sandboxir::ReturnInst>(RetF)->getReturnValue()->getType());
// getExpectedValue for void returns
@@ -988,7 +988,7 @@ define void @bar(float %v, ptr %ptr) {
auto *BarBB = cast<sandboxir::BasicBlock>(Ctx.getValue(&*Bar.begin()));
auto BarIt = BarBB->begin();
auto *RetV = cast<sandboxir::Instruction>(&*BarIt++);
- EXPECT_EQ(sandboxir::SandboxIRUtils::getExpectedValue(RetV), nullptr);
+ EXPECT_EQ(sandboxir::Utils::getExpectedValue(RetV), nullptr);
}
TEST_F(SandboxIRTest, GetNumBits) {
@@ -1004,12 +1004,12 @@ define void @foo(float %arg0, double %arg1, i8 %arg2, i64 %arg34) {
const DataLayout &DL = M->getDataLayout();
// getNumBits for scalars
// float
- EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(0), DL),
+ EXPECT_EQ(sandboxir::Utils::getNumBits(F->getArg(0), DL),
DL.getTypeSizeInBits(Type::getFloatTy(C)));
- EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(1), DL),
+ EXPECT_EQ(sandboxir::Utils::getNumBits(F->getArg(1), DL),
DL.getTypeSizeInBits(Type::getDoubleTy(C)));
- EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(2), DL), 8u);
- EXPECT_EQ(sandboxir::SandboxIRUtils::getNumBits(F->getArg(3), DL), 64u);
+ EXPECT_EQ(sandboxir::Utils::getNumBits(F->getArg(2), DL), 8u);
+ EXPECT_EQ(sandboxir::Utils::getNumBits(F->getArg(3), DL), 64u);
}
TEST_F(SandboxIRTest, RAUW_RUWIf) {
More information about the llvm-commits
mailing list