Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/merge upstream 20210417 #50

Merged
merged 53 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
f549176
[funcattrs] Add the maximal set of implied attributes to definitions
preames Apr 16, 2021
5ebbb36
[OpenMP] Allow affinity to re-detect for child processes
jpeyton52 Mar 23, 2021
7e075ad
[libc] Add endianness support
gchatelet Apr 16, 2021
4457565
[OpenMP] Implement GOMP task reductions
jpeyton52 Mar 15, 2021
2bfe158
[libc] Fix wrongly deduced type
gchatelet Apr 16, 2021
48cc5b0
[gn build] (manually) port ca6751043d88
nico Apr 16, 2021
be0ffbb
[TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.
topperc Apr 16, 2021
bc636c1
[gn build] (manually) port ca6751043d88 better
nico Apr 16, 2021
1170743
[inferattrs] Don't infer lib func attributes for nobuiltin functions
preames Apr 16, 2021
e9fe788
Target::ReadMemory read from read-only binary file Section, not memory
jasonmolenda Apr 16, 2021
06995fe
[clang][NFC] Fix a potential assert failure
benshi001 Apr 16, 2021
ff769dd
[PowerPC] Minor improvement for insert_vector_elt codegen
nemanjai Apr 16, 2021
1206b95
[ASTReader] Only mark module out of date if not already compiled
bnbarham Apr 17, 2021
a623051
[TableGen] Replace two SmallDenseSets with SmallSets.
topperc Apr 17, 2021
b2a3d31
[ELF] Simplify R_386_TLS_GD computation. NFC
MaskRay Apr 17, 2021
fb69b92
[libc][NFC] Add common template test class for sqrt, sqrtf and sqrtl.
Apr 17, 2021
fb706e0
[libc][NFC] Make conversion from FPBits to the float point type expli…
Apr 14, 2021
bb8aa2a
[libc][NFC] Use explicit conversion in modfl_test.
Apr 17, 2021
7db1102
[libc]NFC] Use explicit conversion on frexpl_test and logbl_test.
Apr 17, 2021
bbba694
[libc][NFC] Use explicit conversion in aarch64 FEnv.
Apr 17, 2021
d6de1e1
Normalize interaction with boolean attributes
Mar 24, 2021
7c74ce3
[ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRe…
MaskRay Apr 17, 2021
4583759
[Sanitizers] Undefined Behavior Sanitizer support for DragonFlyBSD
devnexen Apr 17, 2021
0df0d6a
[Sanitizers] DragonFlyBSD adding support for builtins
devnexen Apr 17, 2021
61fc02d
[Sanitizers] Fix build
devnexen Apr 17, 2021
5953943
[Support] AbsoluteDifference - add brackets to appease static analyze…
RKSimon Apr 17, 2021
e68b12c
[Inline] Don't add noalias metadata to inaccessiblememonly calls
nikic Apr 17, 2021
af52351
[SimplifyCFG] Skip dbg intrinsics when checking for branch-only BBs.
fhahn Apr 17, 2021
ae2da68
[LICM] Add more tests for promotion and capture (NFC)
nikic Apr 17, 2021
3597f02
[AMDGPU] Add GlobalDCE before internalization pass
yxsamliu Mar 17, 2021
d5c0f00
[CUDA][HIP] Mark device var used by host only
yxsamliu Mar 17, 2021
12a1f1d
[Pragma] Added support for GCC unroll/nounroll
davidbolvansky Apr 17, 2021
6823af0
[HIP] Support hipRTC in header
yxsamliu Apr 16, 2021
f8f6029
[libcxx][doc] Fixes typos.
mordante Apr 17, 2021
bbf01f9
[ADT] Take graph as const & in some post-order iterators (NFC).
fhahn Apr 17, 2021
ebc6608
[AST] Remove args from LocationCall
steveire Apr 16, 2021
21bef4e
[NFC] Fixed Typos
jnyfah Apr 17, 2021
a5e579c
[TableGen] Remove local SmallSet from TypeSetByHwMode::insert.
topperc Apr 17, 2021
141945f
[AST] Enable AST node introspection on WIN32
steveire Apr 17, 2021
7b75a3a
[Support] ThreadPool tests: silence warning unused variable 'It'
aganea Apr 17, 2021
488a19d
[clang-scan-deps] Support double-dashes in clang command lines
sylvain-audi Apr 17, 2021
bb26fa8
[clang-scan-deps] Add support for clang-cl
sylvain-audi Apr 17, 2021
0c6ee50
[JITLink] Add testcase that was accidentally left out of 19e402d2b34.
lhames Apr 17, 2021
fe9a5a8
[LoopUnroll] Make some tests more robust (NFC)
nikic Apr 17, 2021
c456ab7
[LoopUnroll] Regenerate test checks (NFC)
nikic Apr 17, 2021
d91f864
[ADT] Update RPOT to work with specializations of different types.
fhahn Apr 17, 2021
863d5c4
[libc++] Remove hard tabs, U+00AD, and U+200B from all libc++ headers…
Quuxplusone Apr 17, 2021
dd68942
[AST] Add TypeLoc support to node introspection
steveire Mar 24, 2021
1296af1
[VE] Revert SelectionDAGNodes.h
kaz7 Jul 7, 2021
d05f42c
[VE] Revert local modifications caused by clang-format
kaz7 Jul 7, 2021
8169b6b
[VP]workaround: Run ExpandVP in opt with legacy pm (default in isel)
simoll Jul 8, 2021
c26b4d3
[VE] Disable relative lookup table converter pass for VE
kaz7 Jul 9, 2021
8fcaf22
Merge commit 'dd68942f1d79986267a58c9a9924522680d5c82b' into feature/…
kaz7 Jul 10, 2021
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
2 changes: 1 addition & 1 deletion clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ generate a reproducer for warnings or errors while using modules.
.. option:: -gen-reproducer

Generates preprocessed source files, a reproducer script and if relevant, a
cache containing: built module pcm's and all headers needed to rebuilt the
cache containing: built module pcm's and all headers needed to rebuild the
same modules.

.. _rpass:
Expand Down
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,9 @@ def UnrollHintDocs : Documentation {
let Content = [{
Loop unrolling optimization hints can be specified with ``#pragma unroll`` and
``#pragma nounroll``. The pragma is placed immediately before a for, while,
do-while, or c++11 range-based for loop.
do-while, or c++11 range-based for loop. GCC's loop unrolling hints
``#pragma GCC unroll`` and ``#pragma GCC nounroll`` are also supported and have
identical semantics to ``#pragma unroll`` and ``#pragma nounroll``.

Specifying ``#pragma unroll`` without a parameter directs the loop unroller to
attempt to fully unroll the loop if the trip count is known at compile time and
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/TargetBuiltins.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ namespace clang {
}

static constexpr uint64_t LargestBuiltinID = std::max<uint64_t>(
{NEON::FirstTSBuiltin, ARM::LastTSBuiltin, SVE::FirstTSBuiltin,
AArch64::LastTSBuiltin, BPF::LastTSBuiltin, PPC::LastTSBuiltin,
NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin, X86::LastTSBuiltin,
{ARM::LastTSBuiltin, AArch64::LastTSBuiltin, BPF::LastTSBuiltin,
PPC::LastTSBuiltin, NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin,
X86::LastTSBuiltin, VE::LastTSBuiltin, RISCV::LastTSBuiltin,
Hexagon::LastTSBuiltin, Mips::LastTSBuiltin, XCore::LastTSBuiltin,
Le64::LastTSBuiltin, SystemZ::LastTSBuiltin,
WebAssembly::LastTSBuiltin});
Expand Down
7 changes: 1 addition & 6 deletions clang/include/clang/Tooling/NodeIntrospection.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,16 @@ class LocationCall : public llvm::ThreadSafeRefCountedBase<LocationCall> {
LocationCall(SharedLocationCall on, std::string name,
LocationCallFlags flags = NoFlags)
: m_flags(flags), m_on(std::move(on)), m_name(std::move(name)) {}
LocationCall(SharedLocationCall on, std::string name,
std::vector<std::string> args, LocationCallFlags flags = NoFlags)
: m_flags(flags), m_on(std::move(on)), m_name(std::move(name)),
m_args(std::move(args)) {}

LocationCall *on() const { return m_on.get(); }
StringRef name() const { return m_name; }
ArrayRef<std::string> args() const { return m_args; }
bool returnsPointer() const { return m_flags & ReturnsPointer; }
bool isCast() const { return m_flags & IsCast; }

private:
LocationCallFlags m_flags;
SharedLocationCall m_on;
std::string m_name;
std::vector<std::string> m_args;
};

class LocationCallFormatterCpp {
Expand Down Expand Up @@ -92,6 +86,7 @@ NodeLocationAccessors GetLocations(clang::CXXCtorInitializer const *Object);
NodeLocationAccessors GetLocations(clang::NestedNameSpecifierLoc const *);
NodeLocationAccessors GetLocations(clang::TemplateArgumentLoc const *);
NodeLocationAccessors GetLocations(clang::CXXBaseSpecifier const *);
NodeLocationAccessors GetLocations(clang::TypeLoc const &);
NodeLocationAccessors GetLocations(clang::DynTypedNode const &Node);
} // namespace NodeIntrospection
} // namespace tooling
Expand Down
22 changes: 22 additions & 0 deletions clang/lib/CodeGen/CGCUDANV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,28 @@ void CGNVCUDARuntime::transformManagedVars() {
llvm::Function *CGNVCUDARuntime::finalizeModule() {
if (CGM.getLangOpts().CUDAIsDevice) {
transformManagedVars();

// Mark ODR-used device variables as compiler used to prevent it from being
// eliminated by optimization. This is necessary for device variables
// ODR-used by host functions. Sema correctly marks them as ODR-used no
// matter whether they are ODR-used by device or host functions.
//
// We do not need to do this if the variable has used attribute since it
// has already been added.
//
// Static device variables have been externalized at this point, therefore
// variables with LLVM private or internal linkage need not be added.
for (auto &&Info : DeviceVars) {
auto Kind = Info.Flags.getKind();
if (!Info.Var->isDeclaration() &&
!llvm::GlobalValue::isLocalLinkage(Info.Var->getLinkage()) &&
(Kind == DeviceVarFlags::Variable ||
Kind == DeviceVarFlags::Surface ||
Kind == DeviceVarFlags::Texture) &&
Info.D->isUsed() && !Info.D->hasAttr<UsedAttr>()) {
CGM.addCompilerUsedGlobal(Info.Var);
}
}
return nullptr;
}
return makeModuleCtorFunction();
Expand Down
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CGExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
DestLV.setTBAAInfo(TBAAAccessInfo::getMayAliasInfo());
return EmitLoadOfLValue(DestLV, CE->getExprLoc());
}

return Builder.CreateBitCast(Src, DstTy);
}
case CK_AddressSpaceConversion: {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void CodeGenFunction::CGFPOptionsRAII::ConstructorHelper(FPOptions FPFeatures) {

auto mergeFnAttrValue = [&](StringRef Name, bool Value) {
auto OldValue =
CGF.CurFn->getFnAttribute(Name).getValueAsString() == "true";
CGF.CurFn->getFnAttribute(Name).getValueAsBool();
auto NewValue = OldValue & Value;
if (OldValue != NewValue)
CGF.CurFn->addFnAttr(Name, llvm::toStringRef(NewValue));
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Headers/__clang_hip_cmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
#error "This file is for HIP and OpenMP AMDGCN device compilation only."
#endif

#if !defined(__HIPCC_RTC__)
#if defined(__cplusplus)
#include <limits>
#include <type_traits>
#include <utility>
#endif
#include <limits.h>
#include <stdint.h>
#endif // __HIPCC_RTC__

#pragma push_macro("__DEVICE__")
#define __DEVICE__ static __device__ inline __attribute__((always_inline))
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Headers/__clang_hip_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
#error "This file is for HIP and OpenMP AMDGCN device compilation only."
#endif

#if !defined(__HIPCC_RTC__)
#if defined(__cplusplus)
#include <algorithm>
#endif
#include <limits.h>
#include <stdint.h>
#endif // __HIPCC_RTC__

#pragma push_macro("__DEVICE__")
#define __DEVICE__ static __device__ inline __attribute__((always_inline))
Expand Down Expand Up @@ -1260,13 +1262,15 @@ float min(float __x, float __y) { return fminf(__x, __y); }
__DEVICE__
double min(double __x, double __y) { return fmin(__x, __y); }

#if !defined(__HIPCC_RTC__)
__host__ inline static int min(int __arg1, int __arg2) {
return std::min(__arg1, __arg2);
}

__host__ inline static int max(int __arg1, int __arg2) {
return std::max(__arg1, __arg2);
}
#endif // __HIPCC_RTC__
#endif

#pragma pop_macro("__DEVICE__")
Expand Down
28 changes: 27 additions & 1 deletion clang/lib/Headers/__clang_hip_runtime_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,27 @@

#if __HIP__

#if !defined(__HIPCC_RTC__)
#include <cmath>
#include <cstdlib>
#include <stdlib.h>
#else
typedef __SIZE_TYPE__ size_t;
// Define macros which are needed to declare HIP device API's without standard
// C/C++ headers. This is for readability so that these API's can be written
// the same way as non-hipRTC use case. These macros need to be popped so that
// they do not pollute users' name space.
#pragma push_macro("NULL")
#pragma push_macro("uint32_t")
#pragma push_macro("uint64_t")
#pragma push_macro("CHAR_BIT")
#pragma push_macro("INT_MAX")
#define NULL (void *)0
#define uint32_t __UINT32_TYPE__
#define uint64_t __UINT64_TYPE__
#define CHAR_BIT __CHAR_BIT__
#define INT_MAX __INTMAX_MAX__
#endif // __HIPCC_RTC__

#define __host__ __attribute__((host))
#define __device__ __attribute__((device))
Expand Down Expand Up @@ -54,6 +72,7 @@ static inline __device__ void *free(void *__ptr) {
#include <__clang_hip_libdevice_declares.h>
#include <__clang_hip_math.h>

#if !defined(__HIPCC_RTC__)
#if !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
#include <__clang_cuda_math_forward_declares.h>
#include <__clang_hip_cmath.h>
Expand All @@ -62,9 +81,16 @@ static inline __device__ void *free(void *__ptr) {
#include <algorithm>
#include <complex>
#include <new>
#endif // __HIPCC_RTC__
#endif // !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__

#define __CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__ 1

#if defined(__HIPCC_RTC__)
#pragma pop_macro("NULL")
#pragma pop_macro("uint32_t")
#pragma pop_macro("uint64_t")
#pragma pop_macro("CHAR_BIT")
#pragma pop_macro("INT_MAX")
#endif // __HIPCC_RTC__
#endif // __HIP__
#endif // __CLANG_HIP_RUNTIME_WRAPPER_H__
4 changes: 4 additions & 0 deletions clang/lib/Parse/ParsePragma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,11 @@ void Parser::initializePragmaHandlers() {

UnrollHintHandler = std::make_unique<PragmaUnrollHintHandler>("unroll");
PP.AddPragmaHandler(UnrollHintHandler.get());
PP.AddPragmaHandler("GCC", UnrollHintHandler.get());

NoUnrollHintHandler = std::make_unique<PragmaUnrollHintHandler>("nounroll");
PP.AddPragmaHandler(NoUnrollHintHandler.get());
PP.AddPragmaHandler("GCC", NoUnrollHintHandler.get());

UnrollAndJamHintHandler =
std::make_unique<PragmaUnrollHintHandler>("unroll_and_jam");
Expand Down Expand Up @@ -523,9 +525,11 @@ void Parser::resetPragmaHandlers() {
LoopHintHandler.reset();

PP.RemovePragmaHandler(UnrollHintHandler.get());
PP.RemovePragmaHandler("GCC", UnrollHintHandler.get());
UnrollHintHandler.reset();

PP.RemovePragmaHandler(NoUnrollHintHandler.get());
PP.RemovePragmaHandler("GCC", NoUnrollHintHandler.get());
NoUnrollHintHandler.reset();

PP.RemovePragmaHandler(UnrollAndJamHintHandler.get());
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,9 +2760,10 @@ ASTReader::ReadControlBlock(ModuleFile &F,

bool hasErrors = Record[6];
if (hasErrors && !DisableValidation) {
// If requested by the caller, mark modules on error as out-of-date.
if (F.Kind == MK_ImplicitModule &&
(ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate))
// If requested by the caller and the module hasn't already been read
// or compiled, mark modules on error as out-of-date.
if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
!ModuleMgr.getModuleCache().isPCMFinal(F.FileName))
return OutOfDate;

if (!AllowASTWithCompilerErrors) {
Expand Down
5 changes: 4 additions & 1 deletion clang/lib/Tooling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} ${PATH_LIB_END} -1 PATH_TAIL)
string(CONCAT BINARY_INCLUDE_DIR ${PATH_HEAD} "/include/clang/" ${PATH_TAIL})

if (NOT Python3_EXECUTABLE
OR WIN32
OR APPLE
OR GENERATOR_IS_MULTI_CONFIG
OR NOT LLVM_NATIVE_ARCH IN_LIST LLVM_TARGETS_TO_BUILD
Expand Down Expand Up @@ -59,6 +58,10 @@ NodeLocationAccessors NodeIntrospection::GetLocations(
clang::CXXBaseSpecifier const*) {
return {};
}
NodeLocationAccessors NodeIntrospection::GetLocations(
clang::TypeLoc const&) {
return {};
}
NodeLocationAccessors
NodeIntrospection::GetLocations(clang::DynTypedNode const &) {
return {};
Expand Down
8 changes: 3 additions & 5 deletions clang/lib/Tooling/DumpTool/APIData.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ namespace clang {
namespace tooling {

struct ClassData {

bool isEmpty() const {
return ASTClassLocations.empty() && ASTClassRanges.empty();
}

std::vector<std::string> ASTClassLocations;
std::vector<std::string> ASTClassRanges;
std::vector<std::string> TemplateParms;
std::vector<std::string> TypeSourceInfos;
std::vector<std::string> TypeLocs;
// TODO: Extend this with locations available via typelocs etc.
};

Expand Down
Loading