Builtins refactor - phase3 (#598)
* moved all function names in Constants.h to builtins (mangled names in Constants.cpp)
* add some missing functions (pack, unpack, composite_construct, copy_memory, atomic_xor)
* replaced all new function creation with name generation from Builtins::GetMangledFunctionName (ReplaceOpenCLBuiltinPass.cpp)
* moved most CallInst codegen for Builtins to GenerateInstruction (from HandleDeferredInstruction)
* removed all image test routines from Builtins (replaced with Builtins::Lookup)
* updated IR tests
Enhancement as part of https://github.com/google/clspv/issues/545
diff --git a/lib/MultiVersionUBOFunctionsPass.cpp b/lib/MultiVersionUBOFunctionsPass.cpp
index d67cb29..6f1265c 100644
--- a/lib/MultiVersionUBOFunctionsPass.cpp
+++ b/lib/MultiVersionUBOFunctionsPass.cpp
@@ -33,6 +33,7 @@
#include "clspv/Passes.h"
#include "ArgKind.h"
+#include "Builtins.h"
#include "CallGraphOrderedFunctions.h"
#include "Constants.h"
@@ -152,8 +153,8 @@
continue;
if (CallInst *call = dyn_cast<CallInst>(value)) {
- if (call->getCalledFunction()->getName().startswith(
- clspv::ResourceAccessorFunction())) {
+ auto &func_info = clspv::Builtins::Lookup(call->getCalledFunction());
+ if (func_info.getType() == clspv::Builtins::kClspvResource) {
info.base = call;
} else {
// Unknown function call returning a constant pointer requires