Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions llvm/tools/sycl-post-link/SpecConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,27 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
int NextID = 0;
StringMap<unsigned> IDMap;

// Iterate through all calls to
// Iterate through all declarations of instances of function template
// template <typename T> T __sycl_getSpecConstantValue(const char *ID)
// intrinsic and lower them depending on the SetValAtRT setting (see below).
// intrinsic to find its calls and lower them depending on the SetValAtRT
// setting (see below).
bool IRModified = false;

for (Function &F : M) {
if (F.isDeclaration())
if (!F.isDeclaration())
continue;
SmallVector<CallInst *, 32> SCIntrCalls;

for (Instruction &I : instructions(F)) {
auto *CI = dyn_cast<CallInst>(&I);
Function *Callee = nullptr;
if (!CI || CI->isIndirectCall() || !(Callee = CI->getCalledFunction()))
continue;
StringRef Name = Callee->getName();
if (!F.getName().startswith(SYCL_GET_SPEC_CONST_VAL))
continue;

if (!Name.startswith(SYCL_GET_SPEC_CONST_VAL))
SmallVector<CallInst *, 32> SCIntrCalls;
for (auto *U : F.users()) {
auto *CI = dyn_cast<CallInst>(U);
if (!CI)
continue;
SCIntrCalls.push_back(CI);
}

IRModified = IRModified || (SCIntrCalls.size() > 0);

for (auto *CI : SCIntrCalls) {
Expand Down