11 changes: 6 additions & 5 deletions clang/lib/Frontend/CompilerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,8 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
SourceLocation ModuleNameLoc, bool IsInclusionDirective) {
// Search for a module with the given name.
HeaderSearch &HS = PP->getHeaderSearchInfo();
Module *M = HS.lookupModule(ModuleName, true, !IsInclusionDirective);
Module *M =
HS.lookupModule(ModuleName, ImportLoc, true, !IsInclusionDirective);

// Select the source and filename for loading the named module.
std::string ModuleFilename;
Expand Down Expand Up @@ -1829,7 +1830,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(

// A prebuilt module is indexed as a ModuleFile; the Module does not exist
// until the first call to ReadAST. Look it up now.
M = HS.lookupModule(ModuleName, true, !IsInclusionDirective);
M = HS.lookupModule(ModuleName, ImportLoc, true, !IsInclusionDirective);

// Check whether M refers to the file in the prebuilt module path.
if (M && M->getASTFile())
Expand Down Expand Up @@ -1952,7 +1953,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
} else if (ModuleName == getLangOpts().CurrentModule) {
// This is the module we're building.
Module = PP->getHeaderSearchInfo().lookupModule(
ModuleName, /*AllowSearch*/ true,
ModuleName, ImportLoc, /*AllowSearch*/ true,
/*AllowExtraModuleMapSearch*/ !IsInclusionDirective);
/// FIXME: perhaps we should (a) look for a module using the module name
// to file map (PrebuiltModuleFiles) and (b) diagnose if still not found?
Expand Down Expand Up @@ -2001,8 +2002,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
PrivateModule, PP->getIdentifierInfo(Module->Name)->getTokenID());
PrivPath.push_back(std::make_pair(&II, Path[0].second));

if (PP->getHeaderSearchInfo().lookupModule(PrivateModule, true,
!IsInclusionDirective))
if (PP->getHeaderSearchInfo().lookupModule(PrivateModule, ImportLoc,
true, !IsInclusionDirective))
Sub =
loadModule(ImportLoc, PrivPath, Visibility, IsInclusionDirective);
if (Sub) {
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Frontend/FrontendAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
Module *FrontendAction::getCurrentModule() const {
CompilerInstance &CI = getCompilerInstance();
return CI.getPreprocessor().getHeaderSearchInfo().lookupModule(
CI.getLangOpts().CurrentModule, /*AllowSearch*/false);
CI.getLangOpts().CurrentModule, SourceLocation(), /*AllowSearch*/false);
}

std::unique_ptr<ASTConsumer>
Expand Down Expand Up @@ -472,7 +472,7 @@ static Module *prepareToBuildModule(CompilerInstance &CI,

// Dig out the module definition.
HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
Module *M = HS.lookupModule(CI.getLangOpts().CurrentModule,
Module *M = HS.lookupModule(CI.getLangOpts().CurrentModule, SourceLocation(),
/*AllowSearch=*/true);
if (!M) {
CI.getDiagnostics().Report(diag::err_missing_module)
Expand Down Expand Up @@ -630,7 +630,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
if (Kind.getFormat() == InputKind::ModuleMap) {
Module *ASTModule =
AST->getPreprocessor().getHeaderSearchInfo().lookupModule(
AST->getLangOpts().CurrentModule, /*AllowSearch*/ false);
AST->getLangOpts().CurrentModule, SourceLocation(),
/*AllowSearch*/ false);
assert(ASTModule && "module file does not define its own module");
Input = FrontendInputFile(ASTModule->PresumedModuleMapFile, Kind);
} else {
Expand Down
83 changes: 57 additions & 26 deletions clang/lib/Frontend/InitHeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ namespace {
struct DirectoryLookupInfo {
IncludeDirGroup Group;
DirectoryLookup Lookup;
Optional<unsigned> UserEntryIdx;

DirectoryLookupInfo(IncludeDirGroup Group, DirectoryLookup Lookup)
: Group(Group), Lookup(Lookup) {}
DirectoryLookupInfo(IncludeDirGroup Group, DirectoryLookup Lookup,
Optional<unsigned> UserEntryIdx)
: Group(Group), Lookup(Lookup), UserEntryIdx(UserEntryIdx) {}
};

/// InitHeaderSearch - This class makes it easier to set the search paths of
Expand All @@ -60,13 +62,15 @@ class InitHeaderSearch {
/// AddPath - Add the specified path to the specified group list, prefixing
/// the sysroot if used.
/// Returns true if the path exists, false if it was ignored.
bool AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework);
bool AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework,
Optional<unsigned> UserEntryIdx = None);

/// AddUnmappedPath - Add the specified path to the specified group list,
/// without performing any sysroot remapping.
/// Returns true if the path exists, false if it was ignored.
bool AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
bool isFramework);
bool isFramework,
Optional<unsigned> UserEntryIdx = None);

/// AddSystemHeaderPrefix - Add the specified prefix to the system header
/// prefix list.
Expand Down Expand Up @@ -119,22 +123,25 @@ static bool CanPrefixSysroot(StringRef Path) {
}

bool InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group,
bool isFramework) {
bool isFramework,
Optional<unsigned> UserEntryIdx) {
// Add the path with sysroot prepended, if desired and this is a system header
// group.
if (HasSysroot) {
SmallString<256> MappedPathStorage;
StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
if (CanPrefixSysroot(MappedPathStr)) {
return AddUnmappedPath(IncludeSysroot + Path, Group, isFramework);
return AddUnmappedPath(IncludeSysroot + Path, Group, isFramework,
UserEntryIdx);
}
}

return AddUnmappedPath(Path, Group, isFramework);
return AddUnmappedPath(Path, Group, isFramework, UserEntryIdx);
}

bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
bool isFramework) {
bool isFramework,
Optional<unsigned> UserEntryIdx) {
assert(!Path.isTriviallyEmpty() && "can't handle empty path here");

FileManager &FM = Headers.getFileMgr();
Expand All @@ -160,7 +167,8 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,

// If the directory exists, add it.
if (auto DE = FM.getOptionalDirectoryRef(MappedPathStr)) {
IncludePath.emplace_back(Group, DirectoryLookup(*DE, Type, isFramework));
IncludePath.emplace_back(Group, DirectoryLookup(*DE, Type, isFramework),
UserEntryIdx);
return true;
}

Expand All @@ -171,7 +179,8 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
if (const HeaderMap *HM = Headers.CreateHeaderMap(*FE)) {
// It is a headermap, add it to the search path.
IncludePath.emplace_back(
Group, DirectoryLookup(HM, Type, Group == IndexHeaderMap));
Group, DirectoryLookup(HM, Type, Group == IndexHeaderMap),
UserEntryIdx);
return true;
}
}
Expand Down Expand Up @@ -471,7 +480,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
/// RemoveDuplicates - If there are duplicate directory entries in the specified
/// search list, remove the later (dead) ones. Returns the number of non-system
/// headers removed, which is used to update NumAngled.
static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
static unsigned RemoveDuplicates(std::vector<DirectoryLookupInfo> &SearchList,
unsigned First, bool Verbose) {
llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs;
llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenFrameworkDirs;
Expand All @@ -480,7 +489,7 @@ static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
for (unsigned i = First; i != SearchList.size(); ++i) {
unsigned DirToRemove = i;

const DirectoryLookup &CurEntry = SearchList[i];
const DirectoryLookup &CurEntry = SearchList[i].Lookup;

if (CurEntry.isNormalDir()) {
// If this isn't the first time we've seen this dir, remove it.
Expand Down Expand Up @@ -510,7 +519,7 @@ static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
for (FirstDir = First;; ++FirstDir) {
assert(FirstDir != i && "Didn't find dupe?");

const DirectoryLookup &SearchEntry = SearchList[FirstDir];
const DirectoryLookup &SearchEntry = SearchList[FirstDir].Lookup;

// If these are different lookup types, then they can't be the dupe.
if (SearchEntry.getLookupType() != CurEntry.getLookupType())
Expand All @@ -532,7 +541,7 @@ static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,

// If the first dir in the search path is a non-system dir, zap it
// instead of the system one.
if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User)
if (SearchList[FirstDir].Lookup.getDirCharacteristic() == SrcMgr::C_User)
DirToRemove = FirstDir;
}

Expand All @@ -554,24 +563,45 @@ static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
return NonSystemRemoved;
}

/// Extract DirectoryLookups from DirectoryLookupInfos.
static std::vector<DirectoryLookup>
extractLookups(const std::vector<DirectoryLookupInfo> &Infos) {
std::vector<DirectoryLookup> Lookups;
Lookups.reserve(Infos.size());
llvm::transform(Infos, std::back_inserter(Lookups),
[](const DirectoryLookupInfo &Info) { return Info.Lookup; });
return Lookups;
}

/// Collect the mapping between indices of DirectoryLookups and UserEntries.
static llvm::DenseMap<unsigned, unsigned>
mapToUserEntries(const std::vector<DirectoryLookupInfo> &Infos) {
llvm::DenseMap<unsigned, unsigned> LookupsToUserEntries;
for (unsigned I = 0, E = Infos.size(); I < E; ++I) {
// Check whether this DirectoryLookup maps to a HeaderSearch::UserEntry.
if (Infos[I].UserEntryIdx)
LookupsToUserEntries.insert({I, *Infos[I].UserEntryIdx});
}
return LookupsToUserEntries;
}

void InitHeaderSearch::Realize(const LangOptions &Lang) {
// Concatenate ANGLE+SYSTEM+AFTER chains together into SearchList.
std::vector<DirectoryLookup> SearchList;
std::vector<DirectoryLookupInfo> SearchList;
SearchList.reserve(IncludePath.size());

// Quoted arguments go first.
for (auto &Include : IncludePath)
if (Include.Group == Quoted)
SearchList.push_back(Include.Lookup);
SearchList.push_back(Include);

// Deduplicate and remember index.
RemoveDuplicates(SearchList, 0, Verbose);
unsigned NumQuoted = SearchList.size();

for (auto &Include : IncludePath)
if (Include.Group == Angled || Include.Group == IndexHeaderMap)
SearchList.push_back(Include.Lookup);
SearchList.push_back(Include);

RemoveDuplicates(SearchList, NumQuoted, Verbose);
unsigned NumAngled = SearchList.size();
Expand All @@ -583,11 +613,11 @@ void InitHeaderSearch::Realize(const LangOptions &Lang) {
Include.Group == CXXSystem) ||
(Lang.ObjC && !Lang.CPlusPlus && Include.Group == ObjCSystem) ||
(Lang.ObjC && Lang.CPlusPlus && Include.Group == ObjCXXSystem))
SearchList.push_back(Include.Lookup);
SearchList.push_back(Include);

for (auto &Include : IncludePath)
if (Include.Group == After)
SearchList.push_back(Include.Lookup);
SearchList.push_back(Include);

// Remove duplicates across both the Angled and System directories. GCC does
// this and failing to remove duplicates across these two groups breaks
Expand All @@ -596,7 +626,8 @@ void InitHeaderSearch::Realize(const LangOptions &Lang) {
NumAngled -= NonSystemRemoved;

bool DontSearchCurDir = false; // TODO: set to true if -I- is set?
Headers.SetSearchPaths(SearchList, NumQuoted, NumAngled, DontSearchCurDir);
Headers.SetSearchPaths(extractLookups(SearchList), NumQuoted, NumAngled,
DontSearchCurDir, mapToUserEntries(SearchList));

Headers.SetSystemHeaderPrefixes(SystemHeaderPrefixes);

Expand All @@ -606,14 +637,14 @@ void InitHeaderSearch::Realize(const LangOptions &Lang) {
for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
if (i == NumQuoted)
llvm::errs() << "#include <...> search starts here:\n";
StringRef Name = SearchList[i].getName();
StringRef Name = SearchList[i].Lookup.getName();
const char *Suffix;
if (SearchList[i].isNormalDir())
if (SearchList[i].Lookup.isNormalDir())
Suffix = "";
else if (SearchList[i].isFramework())
else if (SearchList[i].Lookup.isFramework())
Suffix = " (framework directory)";
else {
assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup");
assert(SearchList[i].Lookup.isHeaderMap() && "Unknown DirectoryLookup");
Suffix = " (headermap)";
}
llvm::errs() << " " << Name << Suffix << "\n";
Expand All @@ -632,9 +663,9 @@ void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
if (E.IgnoreSysRoot) {
Init.AddUnmappedPath(E.Path, E.Group, E.IsFramework);
Init.AddUnmappedPath(E.Path, E.Group, E.IsFramework, i);
} else {
Init.AddPath(E.Path, E.Group, E.IsFramework);
Init.AddPath(E.Path, E.Group, E.IsFramework, i);
}
}

Expand Down
163 changes: 163 additions & 0 deletions clang/lib/Headers/opencl-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -13640,6 +13640,118 @@ uintptr_t __ovld atomic_fetch_sub_explicit(volatile __local atomic_uintptr_t *ob
// The functionality added by cl_ext_float_atomics extension
#if defined(cl_ext_float_atomics)

#if defined(__opencl_c_ext_fp16_global_atomic_load_store)
void __ovld atomic_store(volatile __global atomic_half *object, half operand);
void __ovld atomic_store_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
void __ovld atomic_store_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_load(volatile __global atomic_half *object);
half __ovld atomic_load_explicit(volatile __global atomic_half *object,
memory_order order);
half __ovld atomic_load_explicit(volatile __global atomic_half *object,
memory_order order, memory_scope scope);
half __ovld atomic_exchange(volatile __global atomic_half *object,
half operand);
half __ovld atomic_exchange_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
half __ovld atomic_exchange_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_load_store)

#if defined(__opencl_c_ext_fp16_local_atomic_load_store)
void __ovld atomic_store(volatile __local atomic_half *object, half operand);
void __ovld atomic_store_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
void __ovld atomic_store_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_load(volatile __local atomic_half *object);
half __ovld atomic_load_explicit(volatile __local atomic_half *object,
memory_order order);
half __ovld atomic_load_explicit(volatile __local atomic_half *object,
memory_order order, memory_scope scope);
half __ovld atomic_exchange(volatile __local atomic_half *object, half operand);
half __ovld atomic_exchange_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
half __ovld atomic_exchange_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_local_atomic_load_store)

#if defined(__opencl_c_ext_fp16_global_atomic_load_store) && \
defined(__opencl_c_ext_fp16_local_atomic_load_store)
void __ovld atomic_store(volatile atomic_half *object, half operand);
void __ovld atomic_store_explicit(volatile atomic_half *object, half operand,
memory_order order);
void __ovld atomic_store_explicit(volatile atomic_half *object, half operand,
memory_order order, memory_scope scope);
half __ovld atomic_load(volatile atomic_half *object);
half __ovld atomic_load_explicit(volatile atomic_half *object,
memory_order order);
half __ovld atomic_load_explicit(volatile atomic_half *object,
memory_order order, memory_scope scope);
half __ovld atomic_exchange(volatile atomic_half *object, half operand);
half __ovld atomic_exchange_explicit(volatile atomic_half *object, half operand,
memory_order order);
half __ovld atomic_exchange_explicit(volatile atomic_half *object, half operand,
memory_order order, memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_load_store) &&
// defined(__opencl_c_ext_fp16_local_atomic_load_store)

#if defined(__opencl_c_ext_fp16_global_atomic_min_max)
half __ovld atomic_fetch_min(volatile __global atomic_half *object,
half operand);
half __ovld atomic_fetch_max(volatile __global atomic_half *object,
half operand);
half __ovld atomic_fetch_min_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_max_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_min_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_max_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_min_max)

#if defined(__opencl_c_ext_fp16_local_atomic_min_max)
half __ovld atomic_fetch_min(volatile __local atomic_half *object,
half operand);
half __ovld atomic_fetch_max(volatile __local atomic_half *object,
half operand);
half __ovld atomic_fetch_min_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_max_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_min_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_max_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_local_atomic_min_max)

#if defined(__opencl_c_ext_fp16_global_atomic_min_max) && \
defined(__opencl_c_ext_fp16_local_atomic_min_max)
half __ovld atomic_fetch_min(volatile atomic_half *object, half operand);
half __ovld atomic_fetch_max(volatile atomic_half *object, half operand);
half __ovld atomic_fetch_min_explicit(volatile atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_max_explicit(volatile atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_min_explicit(volatile atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_max_explicit(volatile atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_min_max) && \
defined(__opencl_c_ext_fp16_local_atomic_min_max)

#if defined(__opencl_c_ext_fp32_global_atomic_min_max)
float __ovld atomic_fetch_min(volatile __global atomic_float *object,
float operand);
Expand Down Expand Up @@ -13742,6 +13854,57 @@ double __ovld atomic_fetch_max_explicit(volatile atomic_double *object,
#endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
defined(__opencl_c_ext_fp64_local_atomic_min_max)

#if defined(__opencl_c_ext_fp16_global_atomic_add)
half __ovld atomic_fetch_add(volatile __global atomic_half *object,
half operand);
half __ovld atomic_fetch_sub(volatile __global atomic_half *object,
half operand);
half __ovld atomic_fetch_add_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_sub_explicit(volatile __global atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_add_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_sub_explicit(volatile __global atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_add)

#if defined(__opencl_c_ext_fp16_local_atomic_add)
half __ovld atomic_fetch_add(volatile __local atomic_half *object,
half operand);
half __ovld atomic_fetch_sub(volatile __local atomic_half *object,
half operand);
half __ovld atomic_fetch_add_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_sub_explicit(volatile __local atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_add_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_sub_explicit(volatile __local atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_local_atomic_add)

#if defined(__opencl_c_ext_fp16_global_atomic_add) && \
defined(__opencl_c_ext_fp16_local_atomic_add)
half __ovld atomic_fetch_add(volatile atomic_half *object, half operand);
half __ovld atomic_fetch_sub(volatile atomic_half *object, half operand);
half __ovld atomic_fetch_add_explicit(volatile atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_sub_explicit(volatile atomic_half *object,
half operand, memory_order order);
half __ovld atomic_fetch_add_explicit(volatile atomic_half *object,
half operand, memory_order order,
memory_scope scope);
half __ovld atomic_fetch_sub_explicit(volatile atomic_half *object,
half operand, memory_order order,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp16_global_atomic_add) && \
defined(__opencl_c_ext_fp16_local_atomic_add)

#if defined(__opencl_c_ext_fp32_global_atomic_add)
float __ovld atomic_fetch_add(volatile __global atomic_float *object,
float operand);
Expand Down
13 changes: 0 additions & 13 deletions clang/lib/Lex/HeaderMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,6 @@ LLVM_DUMP_METHOD void HeaderMapImpl::dump() const {
}
}

/// LookupFile - Check to see if the specified relative filename is located in
/// this HeaderMap. If so, open it and return its FileEntry.
Optional<FileEntryRef> HeaderMap::LookupFile(StringRef Filename,
FileManager &FM) const {

SmallString<1024> Path;
StringRef Dest = HeaderMapImpl::lookupFilename(Filename, Path);
if (Dest.empty())
return None;

return FM.getOptionalFileRef(Dest);
}

StringRef HeaderMapImpl::lookupFilename(StringRef Filename,
SmallVectorImpl<char> &DestPath) const {
const HMapHeader &Hdr = getHeader();
Expand Down
76 changes: 62 additions & 14 deletions clang/lib/Lex/HeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ void HeaderSearch::PrintStats() {
<< NumSubFrameworkLookups << " subframework lookups.\n";
}

std::vector<bool> HeaderSearch::computeUserEntryUsage() const {
std::vector<bool> UserEntryUsage(HSOpts->UserEntries.size());
for (unsigned I = 0, E = SearchDirsUsage.size(); I < E; ++I) {
// Check whether this DirectoryLookup has been successfully used.
if (SearchDirsUsage[I]) {
auto UserEntryIdxIt = SearchDirToHSEntry.find(I);
// Check whether this DirectoryLookup maps to a HeaderSearch::UserEntry.
if (UserEntryIdxIt != SearchDirToHSEntry.end())
UserEntryUsage[UserEntryIdxIt->second] = true;
}
}
return UserEntryUsage;
}

/// CreateHeaderMap - This method returns a HeaderMap for the specified
/// FileEntry, uniquing them through the 'HeaderMaps' datastructure.
const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE) {
Expand Down Expand Up @@ -229,15 +243,17 @@ std::string HeaderSearch::getCachedModuleFileNameImpl(StringRef ModuleName,
return Result.str().str();
}

Module *HeaderSearch::lookupModule(StringRef ModuleName, bool AllowSearch,
Module *HeaderSearch::lookupModule(StringRef ModuleName,
SourceLocation ImportLoc, bool AllowSearch,
bool AllowExtraModuleMapSearch) {
// Look in the module map to determine if there is a module by this name.
Module *Module = ModMap.findModule(ModuleName);
if (Module || !AllowSearch || !HSOpts->ImplicitModuleMaps)
return Module;

StringRef SearchName = ModuleName;
Module = lookupModule(ModuleName, SearchName, AllowExtraModuleMapSearch);
Module = lookupModule(ModuleName, SearchName, ImportLoc,
AllowExtraModuleMapSearch);

// The facility for "private modules" -- adjacent, optional module maps named
// module.private.modulemap that are supposed to define private submodules --
Expand All @@ -248,19 +264,23 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, bool AllowSearch,
// could force building unwanted dependencies into the parent module and cause
// dependency cycles.
if (!Module && SearchName.consume_back("_Private"))
Module = lookupModule(ModuleName, SearchName, AllowExtraModuleMapSearch);
Module = lookupModule(ModuleName, SearchName, ImportLoc,
AllowExtraModuleMapSearch);
if (!Module && SearchName.consume_back("Private"))
Module = lookupModule(ModuleName, SearchName, AllowExtraModuleMapSearch);
Module = lookupModule(ModuleName, SearchName, ImportLoc,
AllowExtraModuleMapSearch);
return Module;
}

Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
SourceLocation ImportLoc,
bool AllowExtraModuleMapSearch) {
Module *Module = nullptr;
unsigned Idx;

// Look through the various header search paths to load any available module
// maps, searching for a module map that describes this module.
for (unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
for (Idx = 0; Idx != SearchDirs.size(); ++Idx) {
if (SearchDirs[Idx].isFramework()) {
// Search for or infer a module map for a framework. Here we use
// SearchName rather than ModuleName, to permit finding private modules
Expand Down Expand Up @@ -323,6 +343,9 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
break;
}

if (Module)
noteLookupUsage(Idx, ImportLoc);

return Module;
}

Expand Down Expand Up @@ -435,16 +458,19 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
if (llvm::sys::path::is_relative(Dest)) {
MappedName.append(Dest.begin(), Dest.end());
Filename = StringRef(MappedName.begin(), MappedName.size());
Optional<FileEntryRef> Result = HM->LookupFile(Filename, HS.getFileMgr());
if (Result) {
FixupSearchPath();
return *Result;
}
} else if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest)) {
Dest = HM->lookupFilename(Filename, Path);
}

if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest)) {
FixupSearchPath();
return *Res;
}

// Header maps need to be marked as used whenever the filename matches.
// The case where the target file **exists** is handled by callee of this
// function as part of the regular logic that applies to include search paths.
// The case where the target file **does not exist** is handled here:
HS.noteLookupUsage(*HS.searchDirIdx(*this), IncludeLoc);
return None;
}

Expand Down Expand Up @@ -649,6 +675,21 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
return None;
}

void HeaderSearch::cacheLookupSuccess(LookupFileCacheInfo &CacheLookup,
unsigned HitIdx, SourceLocation Loc) {
CacheLookup.HitIdx = HitIdx;
noteLookupUsage(HitIdx, Loc);
}

void HeaderSearch::noteLookupUsage(unsigned HitIdx, SourceLocation Loc) {
SearchDirsUsage[HitIdx] = true;

auto UserEntryIdxIt = SearchDirToHSEntry.find(HitIdx);
if (UserEntryIdxIt != SearchDirToHSEntry.end())
Diags.Report(Loc, diag::remark_pp_search_path_usage)
<< HSOpts->UserEntries[UserEntryIdxIt->second].Path;
}

void HeaderSearch::setTarget(const TargetInfo &Target) {
ModMap.setTarget(Target);
}
Expand Down Expand Up @@ -987,7 +1028,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
&File->getFileEntry(), isAngled, FoundByHeaderMap);

// Remember this location for the next lookup we do.
CacheLookup.HitIdx = i;
cacheLookupSuccess(CacheLookup, i, IncludeLoc);
return File;
}

Expand Down Expand Up @@ -1017,8 +1058,8 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
return MSFE;
}

LookupFileCacheInfo &CacheLookup = LookupFileCache[Filename];
CacheLookup.HitIdx = LookupFileCache[ScratchFilename].HitIdx;
cacheLookupSuccess(LookupFileCache[Filename],
LookupFileCache[ScratchFilename].HitIdx, IncludeLoc);
// FIXME: SuggestedModule.
return File;
}
Expand Down Expand Up @@ -1357,6 +1398,13 @@ size_t HeaderSearch::getTotalMemory() const {
+ FrameworkMap.getAllocator().getTotalMemory();
}

Optional<unsigned> HeaderSearch::searchDirIdx(const DirectoryLookup &DL) const {
for (unsigned I = 0; I < SearchDirs.size(); ++I)
if (&SearchDirs[I] == &DL)
return I;
return None;
}

StringRef HeaderSearch::getUniqueFrameworkName(StringRef Framework) {
return FrameworkNames.insert(Framework).first->first();
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ Module *Preprocessor::getModuleForLocation(SourceLocation Loc) {
// to the current module, if there is one.
return getLangOpts().CurrentModule.empty()
? nullptr
: HeaderInfo.lookupModule(getLangOpts().CurrentModule);
: HeaderInfo.lookupModule(getLangOpts().CurrentModule, Loc);
}

const FileEntry *
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/Pragma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ struct PragmaModuleBeginHandler : public PragmaHandler {
// Find the module we're entering. We require that a module map for it
// be loaded or implicitly loadable.
auto &HSI = PP.getHeaderSearchInfo();
Module *M = HSI.lookupModule(Current);
Module *M = HSI.lookupModule(Current, ModuleName.front().second);
if (!M) {
PP.Diag(ModuleName.front().second,
diag::err_pp_module_begin_no_module_map) << Current;
Expand Down
118 changes: 118 additions & 0 deletions clang/lib/Sema/OpenCLBuiltins.td
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,25 @@ def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sha

def FuncExtOpenCLCPipes : FunctionExtension<"__opencl_c_pipes">;
def FuncExtOpenCLCWGCollectiveFunctions : FunctionExtension<"__opencl_c_work_group_collective_functions">;
def FuncExtFloatAtomicsFp16GlobalLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store">;
def FuncExtFloatAtomicsFp16LocalLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_load_store">;
def FuncExtFloatAtomicsFp16GenericLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store __opencl_c_ext_fp16_local_atomic_load_store">;
def FuncExtFloatAtomicsFp16GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_add">;
def FuncExtFloatAtomicsFp32GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_add">;
def FuncExtFloatAtomicsFp64GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_add">;
def FuncExtFloatAtomicsFp16LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add">;
def FuncExtFloatAtomicsFp32LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add">;
def FuncExtFloatAtomicsFp64LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add">;
def FuncExtFloatAtomicsFp16GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add __opencl_c_ext_fp16_global_atomic_add">;
def FuncExtFloatAtomicsFp32GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add __opencl_c_ext_fp32_global_atomic_add">;
def FuncExtFloatAtomicsFp64GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add __opencl_c_ext_fp64_global_atomic_add">;
def FuncExtFloatAtomicsFp16GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_min_max">;
def FuncExtFloatAtomicsFp32GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_min_max">;
def FuncExtFloatAtomicsFp64GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_min_max">;
def FuncExtFloatAtomicsFp16LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max">;
def FuncExtFloatAtomicsFp32LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max">;
def FuncExtFloatAtomicsFp64LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max">;
def FuncExtFloatAtomicsFp16GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max __opencl_c_ext_fp16_global_atomic_min_max">;
def FuncExtFloatAtomicsFp32GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max __opencl_c_ext_fp32_global_atomic_min_max">;
def FuncExtFloatAtomicsFp64GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max __opencl_c_ext_fp64_global_atomic_min_max">;

Expand Down Expand Up @@ -362,6 +371,7 @@ def AtomicLong : Type<"atomic_long", QualType<"Context.getAtomicType(
def AtomicULong : Type<"atomic_ulong", QualType<"Context.getAtomicType(Context.UnsignedLongTy)">>;
def AtomicFloat : Type<"atomic_float", QualType<"Context.getAtomicType(Context.FloatTy)">>;
def AtomicDouble : Type<"atomic_double", QualType<"Context.getAtomicType(Context.DoubleTy)">>;
def AtomicHalf : Type<"atomic_half", QualType<"Context.getAtomicType(Context.HalfTy)">>;
def AtomicIntPtr : Type<"atomic_intptr_t", QualType<"Context.getAtomicType(Context.getIntPtrType())">>;
def AtomicUIntPtr : Type<"atomic_uintptr_t", QualType<"Context.getAtomicType(Context.getUIntPtrType())">>;
def AtomicSize : Type<"atomic_size_t", QualType<"Context.getAtomicType(Context.getSizeType())">>;
Expand Down Expand Up @@ -1106,7 +1116,75 @@ let MinVersion = CL20 in {

// The functionality added by cl_ext_float_atomics extension
let MinVersion = CL20 in {
let Extension = FuncExtFloatAtomicsFp16GlobalLoadStore in {
def : Builtin<"atomic_store",
[Void, PointerType<VolatileType<AtomicHalf>, GlobalAS>, AtomicHalf]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, GlobalAS>, AtomicHalf, MemoryOrder]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, GlobalAS>, AtomicHalf, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_load",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, MemoryOrder]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_exchange",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16LocalLoadStore in {
def : Builtin<"atomic_store",
[Void, PointerType<VolatileType<AtomicHalf>, LocalAS>, AtomicHalf]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, LocalAS>, AtomicHalf, MemoryOrder]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, LocalAS>, AtomicHalf, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_load",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, MemoryOrder]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_exchange",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16GenericLoadStore in {
def : Builtin<"atomic_store",
[Void, PointerType<VolatileType<AtomicHalf>, GenericAS>, AtomicHalf]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, GenericAS>, AtomicHalf, MemoryOrder]>;
def : Builtin<"atomic_store_explicit",
[Void, PointerType<VolatileType<AtomicHalf>, GenericAS>, AtomicHalf, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_load",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, MemoryOrder]>;
def : Builtin<"atomic_load_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, MemoryOrder, MemoryScope]>;
def : Builtin<"atomic_exchange",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_exchange_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half, MemoryOrder, MemoryScope]>;
}
foreach ModOp = ["add", "sub"] in {
let Extension = FuncExtFloatAtomicsFp16GlobalAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicFloat>, GlobalAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, GlobalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, GlobalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32GlobalAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, GlobalAS>, Float]>;
Expand All @@ -1123,6 +1201,14 @@ let MinVersion = CL20 in {
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Double, PointerType<VolatileType<AtomicDouble>, GlobalAS>, Double, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16LocalAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicFloat>, LocalAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, LocalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, LocalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32LocalAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, LocalAS>, Float]>;
Expand All @@ -1139,6 +1225,14 @@ let MinVersion = CL20 in {
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Double, PointerType<VolatileType<AtomicDouble>, LocalAS>, Double, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16GenericAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicFloat>, GenericAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, GenericAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicFloat>, GenericAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32GenericAdd in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, GenericAS>, Float]>;
Expand All @@ -1157,6 +1251,14 @@ let MinVersion = CL20 in {
}
}
foreach ModOp = ["min", "max"] in {
let Extension = FuncExtFloatAtomicsFp16GlobalMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GlobalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32GlobalMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, GlobalAS>, Float]>;
Expand All @@ -1173,6 +1275,14 @@ let MinVersion = CL20 in {
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Double, PointerType<VolatileType<AtomicDouble>, GlobalAS>, Double, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16LocalMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, LocalAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32LocalMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, LocalAS>, Float]>;
Expand All @@ -1189,6 +1299,14 @@ let MinVersion = CL20 in {
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Double, PointerType<VolatileType<AtomicDouble>, LocalAS>, Double, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp16GenericMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half, MemoryOrder]>;
def : Builtin<"atomic_fetch_" # ModOp # "_explicit",
[Half, PointerType<VolatileType<AtomicHalf>, GenericAS>, Half, MemoryOrder, MemoryScope]>;
}
let Extension = FuncExtFloatAtomicsFp32GenericMinMax in {
def : Builtin<"atomic_fetch_" # ModOp,
[Float, PointerType<VolatileType<AtomicFloat>, GenericAS>, Float]>;
Expand Down
5 changes: 5 additions & 0 deletions clang/lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ void Sema::Initialize() {
AddPointerSizeDependentTypes();
}

if (getOpenCLOptions().isSupported("cl_khr_fp16", getLangOpts())) {
auto AtomicHalfT = Context.getAtomicType(Context.HalfTy);
addImplicitTypedef("atomic_half", AtomicHalfT);
}

std::vector<QualType> Atomic64BitTypes;
if (getOpenCLOptions().isSupported("cl_khr_int64_base_atomics",
getLangOpts()) &&
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2679,8 +2679,8 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D,
NewAttr = S.mergeEnforceTCBAttr(D, *TCBA);
else if (const auto *TCBLA = dyn_cast<EnforceTCBLeafAttr>(Attr))
NewAttr = S.mergeEnforceTCBLeafAttr(D, *TCBLA);
else if (const auto *BTFA = dyn_cast<BTFTagAttr>(Attr))
NewAttr = S.mergeBTFTagAttr(D, *BTFA);
else if (const auto *BTFA = dyn_cast<BTFDeclTagAttr>(Attr))
NewAttr = S.mergeBTFDeclTagAttr(D, *BTFA);
else if (Attr->shouldInheritEvenIfAlreadyPresent() || !DeclHasAttr(D, Attr))
NewAttr = cast<InheritableAttr>(Attr->clone(S.Context));

Expand Down
22 changes: 11 additions & 11 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6887,28 +6887,28 @@ static void handleBPFPreserveAccessIndexAttr(Sema &S, Decl *D,
Rec->addAttr(::new (S.Context) BPFPreserveAccessIndexAttr(S.Context, AL));
}

static bool hasBTFTagAttr(Decl *D, StringRef Tag) {
for (const auto *I : D->specific_attrs<BTFTagAttr>()) {
if (I->getBTFTag() == Tag)
static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag) {
for (const auto *I : D->specific_attrs<BTFDeclTagAttr>()) {
if (I->getBTFDeclTag() == Tag)
return true;
}
return false;
}

static void handleBTFTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
StringRef Str;
if (!S.checkStringLiteralArgumentAttr(AL, 0, Str))
return;
if (hasBTFTagAttr(D, Str))
if (hasBTFDeclTagAttr(D, Str))
return;

D->addAttr(::new (S.Context) BTFTagAttr(S.Context, AL, Str));
D->addAttr(::new (S.Context) BTFDeclTagAttr(S.Context, AL, Str));
}

BTFTagAttr *Sema::mergeBTFTagAttr(Decl *D, const BTFTagAttr &AL) {
if (hasBTFTagAttr(D, AL.getBTFTag()))
BTFDeclTagAttr *Sema::mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL) {
if (hasBTFDeclTagAttr(D, AL.getBTFDeclTag()))
return nullptr;
return ::new (Context) BTFTagAttr(Context, AL, AL.getBTFTag());
return ::new (Context) BTFDeclTagAttr(Context, AL, AL.getBTFDeclTag());
}

static void handleWebAssemblyExportNameAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
Expand Down Expand Up @@ -7947,8 +7947,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case ParsedAttr::AT_BPFPreserveAccessIndex:
handleBPFPreserveAccessIndexAttr(S, D, AL);
break;
case ParsedAttr::AT_BTFTag:
handleBTFTagAttr(S, D, AL);
case ParsedAttr::AT_BTFDeclTag:
handleBTFDeclTagAttr(S, D, AL);
break;
case ParsedAttr::AT_WebAssemblyExportName:
handleWebAssemblyExportNameAttr(S, D, AL);
Expand Down
8 changes: 5 additions & 3 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ static Module *getTopImportImplicitModule(ModuleManager &ModuleMgr,
StringRef ModuleName = TopImport->ModuleName;
assert(!ModuleName.empty() && "diagnostic options read before module name");

Module *M = PP.getHeaderSearchInfo().lookupModule(ModuleName);
Module *M =
PP.getHeaderSearchInfo().lookupModule(ModuleName, TopImport->ImportLoc);
assert(M && "missing module");
return M;
}
Expand Down Expand Up @@ -2923,7 +2924,7 @@ ASTReader::ReadControlBlock(ModuleFile &F,
// If we've already loaded a module map file covering this module, we may
// have a better path for it (relative to the current build).
Module *M = PP.getHeaderSearchInfo().lookupModule(
F.ModuleName, /*AllowSearch*/ true,
F.ModuleName, F.ImportLoc, /*AllowSearch*/ true,
/*AllowExtraModuleMapSearch*/ true);
if (M && M->Directory) {
// If we're implicitly loading a module, the base directory can't
Expand Down Expand Up @@ -3909,7 +3910,8 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
if (F.Kind == MK_ImplicitModule && ModuleMgr.begin()->Kind != MK_MainFile) {
// An implicitly-loaded module file should have its module listed in some
// module map file that we've already loaded.
Module *M = PP.getHeaderSearchInfo().lookupModule(F.ModuleName);
Module *M =
PP.getHeaderSearchInfo().lookupModule(F.ModuleName, F.ImportLoc);
auto &Map = PP.getHeaderSearchInfo().getModuleMap();
const FileEntry *ModMap = M ? Map.getModuleMapFileForUniquing(M) : nullptr;
// Don't emit module relocation error if we have -fno-validate-pch
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Serialization/GeneratePCH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
Module *Module = nullptr;
if (PP.getLangOpts().isCompilingModule()) {
Module = PP.getHeaderSearchInfo().lookupModule(
PP.getLangOpts().CurrentModule, /*AllowSearch*/ false);
PP.getLangOpts().CurrentModule, SourceLocation(),
/*AllowSearch*/ false);
if (!Module) {
assert(hasErrors && "emitting module but current module doesn't exist");
return;
Expand Down
218 changes: 118 additions & 100 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfredsum.c

Large diffs are not rendered by default.

130 changes: 70 additions & 60 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfwredsum.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,114 +5,124 @@

#include <riscv_vector.h>

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32mf2_f64m1(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32mf2_f64m1(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.nxv1f64.nxv1f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 1 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.nxv1f64.nxv1f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 1 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32mf2_f64m1(vfloat64m1_t dst,
vfloat32mf2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32mf2_f64m1(vfloat64m1_t dst,
vfloat32mf2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m1_f64m1(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m1_f64m1(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.nxv1f64.nxv2f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 2 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.nxv1f64.nxv2f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 2 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m1_f64m1(vfloat64m1_t dst,
vfloat32m1_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m1_f64m1(vfloat64m1_t dst,
vfloat32m1_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m2_f64m1(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m2_f64m1(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.nxv1f64.nxv4f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 4 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.nxv1f64.nxv4f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 4 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m2_f64m1(vfloat64m1_t dst,
vfloat32m2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m2_f64m1(vfloat64m1_t dst,
vfloat32m2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m4_f64m1(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m4_f64m1(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.nxv1f64.nxv8f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 8 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.nxv1f64.nxv8f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 8 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m4_f64m1(vfloat64m1_t dst,
vfloat32m4_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m4_f64m1(vfloat64m1_t dst,
vfloat32m4_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m8_f64m1(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m8_f64m1(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.nxv1f64.nxv16f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 16 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.nxv1f64.nxv16f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 16 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m8_f64m1(vfloat64m1_t dst,
vfloat32m8_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m8_f64m1(vfloat64m1_t dst,
vfloat32m8_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32mf2_f64m1_m(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32mf2_f64m1_m(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.mask.nxv1f64.nxv1f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 1 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 1 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.mask.nxv1f64.nxv1f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 1 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 1 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32mf2_f64m1_m(vbool64_t mask, vfloat64m1_t dst,
vfloat32mf2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(mask, dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32mf2_f64m1_m(vbool64_t mask, vfloat64m1_t dst,
vfloat32mf2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(mask, dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m1_f64m1_m(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m1_f64m1_m(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.mask.nxv1f64.nxv2f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 2 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 2 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.mask.nxv1f64.nxv2f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 2 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 2 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m1_f64m1_m(vbool32_t mask, vfloat64m1_t dst,
vfloat32m1_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(mask, dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m1_f64m1_m(vbool32_t mask, vfloat64m1_t dst,
vfloat32m1_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(mask, dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m2_f64m1_m(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m2_f64m1_m(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.mask.nxv1f64.nxv4f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 4 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 4 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.mask.nxv1f64.nxv4f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 4 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 4 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m2_f64m1_m(vbool16_t mask, vfloat64m1_t dst,
vfloat32m2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(mask, dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m2_f64m1_m(vbool16_t mask, vfloat64m1_t dst,
vfloat32m2_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(mask, dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m4_f64m1_m(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m4_f64m1_m(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.mask.nxv1f64.nxv8f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 8 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 8 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.mask.nxv1f64.nxv8f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 8 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 8 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m4_f64m1_m(vbool8_t mask, vfloat64m1_t dst,
vfloat32m4_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(mask, dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m4_f64m1_m(vbool8_t mask, vfloat64m1_t dst,
vfloat32m4_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(mask, dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredsum_vs_f32m8_f64m1_m(
//
// CHECK-RV64-LABEL: @test_vfwredusum_vs_f32m8_f64m1_m(
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredsum.mask.nxv1f64.nxv16f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 16 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 16 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 1 x double> @llvm.riscv.vfwredusum.mask.nxv1f64.nxv16f32.i64(<vscale x 1 x double> [[DST:%.*]], <vscale x 16 x float> [[VECTOR:%.*]], <vscale x 1 x double> [[SCALAR:%.*]], <vscale x 16 x i1> [[MASK:%.*]], i64 [[VL:%.*]])
// CHECK-RV64-NEXT: ret <vscale x 1 x double> [[TMP0]]
//
vfloat64m1_t test_vfwredsum_vs_f32m8_f64m1_m(vbool4_t mask, vfloat64m1_t dst,
vfloat32m8_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredsum(mask, dst, vector, scalar, vl);
vfloat64m1_t test_vfwredusum_vs_f32m8_f64m1_m(vbool4_t mask, vfloat64m1_t dst,
vfloat32m8_t vector,
vfloat64m1_t scalar, size_t vl) {
return vfwredusum(mask, dst, vector, scalar, vl);
}

// CHECK-RV64-LABEL: @test_vfwredosum_vs_f32mf2_f64m1(
Expand Down
320 changes: 160 additions & 160 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfredsum.c

Large diffs are not rendered by default.

225 changes: 0 additions & 225 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfwredsum.c

This file was deleted.

4 changes: 2 additions & 2 deletions clang/test/CodeGen/attr-btf_tag-dicomposite-2.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct __tag1 __tag2 t1;

Expand Down
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-dicomposite.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct __tag1 __tag2 t1;
struct t1 {
Expand All @@ -15,8 +15,8 @@ int foo(struct t1 *arg) {

// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT:[0-9]+]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

struct __tag1 t2;
struct __tag2 t2 {
Expand Down
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-diglobalvariable.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct t1 {
int a;
Expand All @@ -15,8 +15,8 @@ struct t1 g2;
// CHECK: distinct !DIGlobalVariable(name: "g1", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT:[0-9]+]])
// CHECK: distinct !DIGlobalVariable(name: "g2", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

extern struct t1 g3 __tag1;
struct t1 g3 __tag2;
Expand Down
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -O2 -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct t1 {
int a;
Expand All @@ -15,5 +15,5 @@ int foo2(struct t1 *arg) {

// CHECK: ![[#]] = !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-disubprogram.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct t1 {
int a;
Expand All @@ -14,8 +14,8 @@ int __tag1 __tag2 foo(struct t1 *arg) {

// CHECK: distinct !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

int __tag1 __tag2 foo2(struct t1 *arg);
int foo2(struct t1 *arg) {
Expand Down
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-field.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct t1 {
int a __tag1 __tag2;
Expand All @@ -21,7 +21,7 @@ int foo2(struct t2 *arg) {
}
// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 32, annotations: ![[ANNOT:[0-9]+]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 1, flags: DIFlagBitField, extraData: i64 0, annotations: ![[ANNOT]])
8 changes: 4 additions & 4 deletions clang/test/CodeGen/attr-btf_tag-parameter.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// REQUIRES: x86-registered-target
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s

#define __tag1 __attribute__((btf_tag("tag1")))
#define __tag2 __attribute__((btf_tag("tag2")))
#define __tag1 __attribute__((btf_decl_tag("tag1")))
#define __tag2 __attribute__((btf_decl_tag("tag2")))

struct t1 {
int a;
Expand All @@ -14,5 +14,5 @@ int foo(struct t1 __tag1 __tag2 *arg) {

// CHECK: !DILocalVariable(name: "arg", arg: 1, scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], annotations: ![[ANNOT:[0-9]+]])
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// CHECK-NEXT: Assumption (SubjectMatchRule_function, SubjectMatchRule_objc_method)
// CHECK-NEXT: Availability ((SubjectMatchRule_record, SubjectMatchRule_enum, SubjectMatchRule_enum_constant, SubjectMatchRule_field, SubjectMatchRule_function, SubjectMatchRule_namespace, SubjectMatchRule_objc_category, SubjectMatchRule_objc_implementation, SubjectMatchRule_objc_interface, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property, SubjectMatchRule_objc_protocol, SubjectMatchRule_record, SubjectMatchRule_type_alias, SubjectMatchRule_variable))
// CHECK-NEXT: BPFPreserveAccessIndex (SubjectMatchRule_record)
// CHECK-NEXT: BTFTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field)
// CHECK-NEXT: BTFDeclTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field)
// CHECK-NEXT: BuiltinAlias (SubjectMatchRule_function)
// CHECK-NEXT: CFAuditedTransfer (SubjectMatchRule_function)
// CHECK-NEXT: CFConsumed (SubjectMatchRule_variable_is_parameter)
Expand Down
81 changes: 40 additions & 41 deletions clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp

Large diffs are not rendered by default.

1,144 changes: 572 additions & 572 deletions clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions clang/test/OpenMP/nvptx_allocate_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void bar() {
// CHECK1-NEXT: store i32 0, i32* [[RETVAL]], align 4
// CHECK1-NEXT: store i32 2, i32* @_ZZ4mainE1a, align 4
// CHECK1-NEXT: store double 3.000000e+00, double* [[B]], align 8
// CHECK1-NEXT: [[CALL:%.*]] = call i32 @_Z3fooIiET_v() #[[ATTR6:[0-9]+]]
// CHECK1-NEXT: [[CALL:%.*]] = call i32 @_Z3fooIiET_v() #[[ATTR7:[0-9]+]]
// CHECK1-NEXT: ret i32 [[CALL]]
//
//
Expand Down Expand Up @@ -127,7 +127,7 @@ void bar() {
// CHECK1-NEXT: [[TMP0:%.*]] = load float, float* [[BAR_A]], align 4
// CHECK1-NEXT: [[CONV:%.*]] = fpext float [[TMP0]] to double
// CHECK1-NEXT: store double [[CONV]], double* addrspacecast (double addrspace(3)* @bar_b to double*), align 8
// CHECK1-NEXT: call void @_Z3bazRf(float* nonnull align 4 dereferenceable(4) [[BAR_A]]) #[[ATTR6]]
// CHECK1-NEXT: call void @_Z3bazRf(float* nonnull align 4 dereferenceable(4) [[BAR_A]]) #[[ATTR7]]
// CHECK1-NEXT: ret void
//
//
Expand All @@ -138,9 +138,9 @@ void bar() {
// CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK1-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK1-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 8
// CHECK1-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK1-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK1-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK1-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK1-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK1-NEXT: call void @__omp_outlined__(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]]) #[[ATTR5:[0-9]+]]
// CHECK1-NEXT: ret void
Expand Down
8 changes: 4 additions & 4 deletions clang/test/OpenMP/nvptx_data_sharing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,15 @@ void test_ds(){
// CHECK-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 8
// CHECK-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK-NEXT: [[TMP2:%.*]] = load i8**, i8*** [[GLOBAL_ARGS]], align 8
// CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8*, i8** [[TMP2]], i64 0
// CHECK-NEXT: [[TMP4:%.*]] = bitcast i8** [[TMP3]] to i32**
// CHECK-NEXT: [[TMP5:%.*]] = load i32*, i32** [[TMP4]], align 8
// CHECK-NEXT: call void @__omp_outlined__(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]], i32* [[TMP5]]) #[[ATTR1:[0-9]+]]
// CHECK-NEXT: call void @__omp_outlined__(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]], i32* [[TMP5]]) #[[ATTR3:[0-9]+]]
// CHECK-NEXT: ret void
//
//
Expand Down Expand Up @@ -488,9 +488,9 @@ void test_ds(){
// CHECK-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 8
// CHECK-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK-NEXT: [[TMP2:%.*]] = load i8**, i8*** [[GLOBAL_ARGS]], align 8
// CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8*, i8** [[TMP2]], i64 0
Expand All @@ -499,6 +499,6 @@ void test_ds(){
// CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8*, i8** [[TMP2]], i64 1
// CHECK-NEXT: [[TMP7:%.*]] = bitcast i8** [[TMP6]] to i32**
// CHECK-NEXT: [[TMP8:%.*]] = load i32*, i32** [[TMP7]], align 8
// CHECK-NEXT: call void @__omp_outlined__1(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]], i32* [[TMP5]], i32* [[TMP8]]) #[[ATTR1]]
// CHECK-NEXT: call void @__omp_outlined__1(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]], i32* [[TMP5]], i32* [[TMP8]]) #[[ATTR3]]
// CHECK-NEXT: ret void
//
Original file line number Diff line number Diff line change
Expand Up @@ -2984,7 +2984,6 @@ int main(int argc, char **argv) {
// CHECK4-NEXT: [[ARGC_CASTED:%.*]] = alloca i64, align 8
// CHECK4-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK4-NEXT: [[DOTTHREADID_TEMP_:%.*]] = alloca i32, align 4
// CHECK4-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK4-NEXT: store [10 x i32]* [[B]], [10 x i32]** [[B_ADDR]], align 8
// CHECK4-NEXT: store [10 x i32]* [[C]], [10 x i32]** [[C_ADDR]], align 8
// CHECK4-NEXT: store i32* [[A]], i32** [[A_ADDR]], align 8
Expand All @@ -3004,6 +3003,7 @@ int main(int argc, char **argv) {
// CHECK4-NEXT: [[CONV1:%.*]] = bitcast i64* [[ARGC_CASTED]] to i32*
// CHECK4-NEXT: store i32 [[TMP6]], i32* [[CONV1]], align 4
// CHECK4-NEXT: [[TMP7:%.*]] = load i64, i64* [[ARGC_CASTED]], align 8
// CHECK4-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK4-NEXT: store i32 [[TMP5]], i32* [[DOTTHREADID_TEMP_]], align 4
// CHECK4-NEXT: call void @__omp_outlined__(i32* [[DOTTHREADID_TEMP_]], i32* [[DOTZERO_ADDR]], [10 x i32]* [[TMP0]], [10 x i32]* [[TMP1]], i32* [[TMP2]], i64 [[TMP7]], [10 x i32]* [[TMP3]]) #[[ATTR4:[0-9]+]]
// CHECK4-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 2, i1 false)
Expand Down Expand Up @@ -3318,7 +3318,6 @@ int main(int argc, char **argv) {
// CHECK5-NEXT: [[ARGC_CASTED:%.*]] = alloca i32, align 4
// CHECK5-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK5-NEXT: [[DOTTHREADID_TEMP_:%.*]] = alloca i32, align 4
// CHECK5-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK5-NEXT: store [10 x i32]* [[B]], [10 x i32]** [[B_ADDR]], align 4
// CHECK5-NEXT: store [10 x i32]* [[C]], [10 x i32]** [[C_ADDR]], align 4
// CHECK5-NEXT: store i32* [[A]], i32** [[A_ADDR]], align 4
Expand All @@ -3336,6 +3335,7 @@ int main(int argc, char **argv) {
// CHECK5-NEXT: [[TMP6:%.*]] = load i32, i32* [[ARGC_ADDR]], align 4
// CHECK5-NEXT: store i32 [[TMP6]], i32* [[ARGC_CASTED]], align 4
// CHECK5-NEXT: [[TMP7:%.*]] = load i32, i32* [[ARGC_CASTED]], align 4
// CHECK5-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK5-NEXT: store i32 [[TMP5]], i32* [[DOTTHREADID_TEMP_]], align 4
// CHECK5-NEXT: call void @__omp_outlined__(i32* [[DOTTHREADID_TEMP_]], i32* [[DOTZERO_ADDR]], [10 x i32]* [[TMP0]], [10 x i32]* [[TMP1]], i32* [[TMP2]], i32 [[TMP7]], [10 x i32]* [[TMP3]]) #[[ATTR4:[0-9]+]]
// CHECK5-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 2, i1 false)
Expand Down Expand Up @@ -3641,7 +3641,6 @@ int main(int argc, char **argv) {
// CHECK6-NEXT: [[ARGC_CASTED:%.*]] = alloca i32, align 4
// CHECK6-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK6-NEXT: [[DOTTHREADID_TEMP_:%.*]] = alloca i32, align 4
// CHECK6-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK6-NEXT: store [10 x i32]* [[B]], [10 x i32]** [[B_ADDR]], align 4
// CHECK6-NEXT: store [10 x i32]* [[C]], [10 x i32]** [[C_ADDR]], align 4
// CHECK6-NEXT: store i32* [[A]], i32** [[A_ADDR]], align 4
Expand All @@ -3659,6 +3658,7 @@ int main(int argc, char **argv) {
// CHECK6-NEXT: [[TMP6:%.*]] = load i32, i32* [[ARGC_ADDR]], align 4
// CHECK6-NEXT: store i32 [[TMP6]], i32* [[ARGC_CASTED]], align 4
// CHECK6-NEXT: [[TMP7:%.*]] = load i32, i32* [[ARGC_CASTED]], align 4
// CHECK6-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK6-NEXT: store i32 [[TMP5]], i32* [[DOTTHREADID_TEMP_]], align 4
// CHECK6-NEXT: call void @__omp_outlined__(i32* [[DOTTHREADID_TEMP_]], i32* [[DOTZERO_ADDR]], [10 x i32]* [[TMP0]], [10 x i32]* [[TMP1]], i32* [[TMP2]], i32 [[TMP7]], [10 x i32]* [[TMP3]]) #[[ATTR4:[0-9]+]]
// CHECK6-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 2, i1 false)
Expand Down
30 changes: 15 additions & 15 deletions clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main() {
// CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 8
// CHECK1-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 8
// CHECK1-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 8
// CHECK1-NEXT: call void @_Z3usev() #[[ATTR6:[0-9]+]]
// CHECK1-NEXT: call void @_Z3usev() #[[ATTR7:[0-9]+]]
// CHECK1-NEXT: ret void
//
//
Expand All @@ -70,7 +70,7 @@ int main() {
// CHECK1-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
// CHECK1-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
// CHECK1: user_code.entry:
// CHECK1-NEXT: call void @_Z3usev() #[[ATTR6]]
// CHECK1-NEXT: call void @_Z3usev() #[[ATTR7]]
// CHECK1-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 1, i1 true)
// CHECK1-NEXT: ret void
// CHECK1: worker.exit:
Expand All @@ -84,20 +84,20 @@ int main() {
// CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 8
// CHECK1-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 8
// CHECK1-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 8
// CHECK1-NEXT: call void @_Z4workv() #[[ATTR6]]
// CHECK1-NEXT: call void @_Z4workv() #[[ATTR7]]
// CHECK1-NEXT: ret void
//
//
// CHECK1-LABEL: define {{[^@]+}}@__omp_outlined__1_wrapper
// CHECK1-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {
// CHECK1-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR6:[0-9]+]] {
// CHECK1-NEXT: entry:
// CHECK1-NEXT: [[DOTADDR:%.*]] = alloca i16, align 2
// CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK1-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK1-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 8
// CHECK1-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK1-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK1-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK1-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK1-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK1-NEXT: call void @__omp_outlined__1(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]]) #[[ATTR3:[0-9]+]]
// CHECK1-NEXT: ret void
Expand Down Expand Up @@ -127,7 +127,7 @@ int main() {
// CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 4
// CHECK2-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 4
// CHECK2-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 4
// CHECK2-NEXT: call void @_Z3usev() #[[ATTR6:[0-9]+]]
// CHECK2-NEXT: call void @_Z3usev() #[[ATTR7:[0-9]+]]
// CHECK2-NEXT: ret void
//
//
Expand All @@ -148,7 +148,7 @@ int main() {
// CHECK2-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
// CHECK2-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
// CHECK2: user_code.entry:
// CHECK2-NEXT: call void @_Z3usev() #[[ATTR6]]
// CHECK2-NEXT: call void @_Z3usev() #[[ATTR7]]
// CHECK2-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 1, i1 true)
// CHECK2-NEXT: ret void
// CHECK2: worker.exit:
Expand All @@ -162,20 +162,20 @@ int main() {
// CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 4
// CHECK2-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 4
// CHECK2-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 4
// CHECK2-NEXT: call void @_Z4workv() #[[ATTR6]]
// CHECK2-NEXT: call void @_Z4workv() #[[ATTR7]]
// CHECK2-NEXT: ret void
//
//
// CHECK2-LABEL: define {{[^@]+}}@__omp_outlined__1_wrapper
// CHECK2-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {
// CHECK2-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR6:[0-9]+]] {
// CHECK2-NEXT: entry:
// CHECK2-NEXT: [[DOTADDR:%.*]] = alloca i16, align 2
// CHECK2-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK2-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK2-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 4
// CHECK2-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK2-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK2-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK2-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK2-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK2-NEXT: call void @__omp_outlined__1(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]]) #[[ATTR3:[0-9]+]]
// CHECK2-NEXT: ret void
Expand Down Expand Up @@ -205,7 +205,7 @@ int main() {
// CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 4
// CHECK3-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 4
// CHECK3-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 4
// CHECK3-NEXT: call void @_Z3usev() #[[ATTR6:[0-9]+]]
// CHECK3-NEXT: call void @_Z3usev() #[[ATTR7:[0-9]+]]
// CHECK3-NEXT: ret void
//
//
Expand All @@ -226,7 +226,7 @@ int main() {
// CHECK3-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
// CHECK3-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
// CHECK3: user_code.entry:
// CHECK3-NEXT: call void @_Z3usev() #[[ATTR6]]
// CHECK3-NEXT: call void @_Z3usev() #[[ATTR7]]
// CHECK3-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 1, i1 true)
// CHECK3-NEXT: ret void
// CHECK3: worker.exit:
Expand All @@ -240,20 +240,20 @@ int main() {
// CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 4
// CHECK3-NEXT: store i32* [[DOTGLOBAL_TID_]], i32** [[DOTGLOBAL_TID__ADDR]], align 4
// CHECK3-NEXT: store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], align 4
// CHECK3-NEXT: call void @_Z4workv() #[[ATTR6]]
// CHECK3-NEXT: call void @_Z4workv() #[[ATTR7]]
// CHECK3-NEXT: ret void
//
//
// CHECK3-LABEL: define {{[^@]+}}@__omp_outlined__1_wrapper
// CHECK3-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {
// CHECK3-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR6:[0-9]+]] {
// CHECK3-NEXT: entry:
// CHECK3-NEXT: [[DOTADDR:%.*]] = alloca i16, align 2
// CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca i32, align 4
// CHECK3-NEXT: [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
// CHECK3-NEXT: [[GLOBAL_ARGS:%.*]] = alloca i8**, align 4
// CHECK3-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK3-NEXT: store i16 [[TMP0]], i16* [[DOTADDR]], align 2
// CHECK3-NEXT: store i32 [[TMP1]], i32* [[DOTADDR1]], align 4
// CHECK3-NEXT: store i32 0, i32* [[DOTZERO_ADDR]], align 4
// CHECK3-NEXT: call void @__kmpc_get_shared_variables(i8*** [[GLOBAL_ARGS]])
// CHECK3-NEXT: call void @__omp_outlined__1(i32* [[DOTADDR1]], i32* [[DOTZERO_ADDR]]) #[[ATTR3:[0-9]+]]
// CHECK3-NEXT: ret void
Expand Down
Loading