Skip to content

Commit

Permalink
Merged master:cb82de29601 into amd-gfx:63385c36b23
Browse files Browse the repository at this point in the history
Local branch amd-gfx 63385c3 Merged master:0d7401cf9d5 into amd-gfx:cba70fee0b1
Remote branch master cb82de2 [RISCV] Optimize multiplication by constant
  • Loading branch information
Sw authored and Sw committed Jul 8, 2020
2 parents 63385c3 + cb82de2 commit 233f5f4
Show file tree
Hide file tree
Showing 63 changed files with 869 additions and 525 deletions.
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/ObjCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ class ObjCRuntime {
friend bool operator!=(const ObjCRuntime &left, const ObjCRuntime &right) {
return !(left == right);
}

friend llvm::hash_code hash_value(const ObjCRuntime &OCR) {
return llvm::hash_combine(OCR.getKind(), OCR.getVersion());
}
};

raw_ostream &operator<<(raw_ostream &out, const ObjCRuntime &value);
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3852,6 +3852,10 @@ std::string CompilerInvocation::getModuleHash() const {
for (StringRef Feature : LangOpts->ModuleFeatures)
code = hash_combine(code, Feature);

code = hash_combine(code, LangOpts->ObjCRuntime);
const auto &BCN = LangOpts->CommentOpts.BlockCommandNames;
code = hash_combine(code, hash_combine_range(BCN.begin(), BCN.end()));

// Extend the signature with the target options.
code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU,
TargetOpts->ABI);
Expand Down
13 changes: 10 additions & 3 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13560,12 +13560,14 @@ static getBaseAlignmentAndOffsetFromLValue(const Expr *E, ASTContext &Ctx) {
}
case Stmt::MemberExprClass: {
auto *ME = cast<MemberExpr>(E);
if (ME->isArrow())
break;
auto *FD = dyn_cast<FieldDecl>(ME->getMemberDecl());
if (!FD || FD->getType()->isReferenceType())
break;
auto P = getBaseAlignmentAndOffsetFromLValue(ME->getBase(), Ctx);
Optional<std::pair<CharUnits, CharUnits>> P;
if (ME->isArrow())
P = getBaseAlignmentAndOffsetFromPtr(ME->getBase(), Ctx);
else
P = getBaseAlignmentAndOffsetFromLValue(ME->getBase(), Ctx);
if (!P)
break;
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(FD->getParent());
Expand Down Expand Up @@ -13629,6 +13631,11 @@ static getBaseAlignmentAndOffsetFromPtr(const Expr *E, ASTContext &Ctx) {
}
break;
}
case Stmt::CXXThisExprClass: {
auto *RD = E->getType()->getPointeeType()->getAsCXXRecordDecl();
CharUnits Alignment = Ctx.getASTRecordLayout(RD).getNonVirtualAlignment();
return std::make_pair(Alignment, CharUnits::Zero());
}
case Stmt::UnaryOperatorClass: {
auto *UO = cast<UnaryOperator>(E);
if (UO->getOpcode() == UO_AddrOf)
Expand Down
10 changes: 3 additions & 7 deletions clang/lib/Sema/SemaExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4203,8 +4203,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
break;

case ICK_Compatible_Conversion:
From = ImpCastExprToType(From, ToType, CK_NoOp,
VK_RValue, /*BasePath=*/nullptr, CCK).get();
From = ImpCastExprToType(From, ToType, CK_NoOp, From->getValueKind(),
/*BasePath=*/nullptr, CCK).get();
break;

case ICK_Writeback_Conversion:
Expand Down Expand Up @@ -4441,11 +4441,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
break;

case ICK_Qualification: {
// The qualification keeps the category of the inner expression, unless the
// target type isn't a reference.
ExprValueKind VK =
ToType->isReferenceType() ? From->getValueKind() : VK_RValue;

ExprValueKind VK = From->getValueKind();
CastKind CK = CK_NoOp;

if (ToType->isReferenceType() &&
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
Sema::ReferenceConversions::NestedQualification)
? ICK_Qualification
: ICK_Identity;
ICS.Standard.FromTypePtr = T2.getAsOpaquePtr();
ICS.Standard.setFromType(T2);
ICS.Standard.setToType(0, T2);
ICS.Standard.setToType(1, T1);
ICS.Standard.setToType(2, T1);
Expand Down
31 changes: 29 additions & 2 deletions clang/test/Modules/context-hash.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This test verifies that only strict hashing includes search paths and
// diagnostics in the module context hash.

// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -internal-isystem \
// RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
Expand All @@ -20,8 +23,25 @@
// RUN: echo %t > %t.path
// RUN: cat %t.path %t1 %t2 %t3 %t4 | FileCheck %s

// This test verifies that only strict hashing includes search paths and
// diagnostics in the module context hash.
// This tests things verified by ASTReader::checkLanguageOptions that are not
// part of LangOpts.def.

// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -internal-isystem \
// RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t -x objective-c %s -Rmodule-build 2> %t1
// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -internal-isystem \
// RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
// RUN: -fobjc-runtime=macosx-1.0.0.0 \
// RUN: -fmodules-cache-path=%t -x objective-c %s -Rmodule-build 2> %t2
// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -internal-isystem \
// RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
// RUN: -fcomment-block-commands=lp,bj \
// RUN: -fmodules-cache-path=%t -x objective-c %s -Rmodule-build 2> %t3
// RUN: echo %t > %t.path
// RUN: cat %t.path %t1 %t2 %t3 | FileCheck --check-prefix=LANGOPTS %s

#include <stdio.h>

Expand All @@ -32,3 +52,10 @@
// CHECK: cstd-[[AST_HASH]].pcm'
// CHECK-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
// CHECK: cstd-[[AST_HASH]].pcm'

// LANGOPTS: [[PREFIX:(.*[/\\])+[a-zA-Z0-9.-]+]]
// LANGOPTS: building module 'cstd' as '[[PREFIX]]{{[/\\]}}[[CONTEXT_HASH:[A-Z0-9]+]]{{[/\\]}}cstd-[[AST_HASH:[A-Z0-9]+]].pcm'
// LANGOPTS-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
// LANGOPTS: cstd-[[AST_HASH]].pcm'
// LANGOPTS-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
// LANGOPTS: cstd-[[AST_HASH]].pcm'
6 changes: 6 additions & 0 deletions clang/test/SemaCXX/references.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,9 @@ namespace RefCollapseTypePrinting {
template void add_rref<const int&>(); // expected-note {{instantiation of}}
template void add_rref<const int&&>(); // expected-note {{instantiation of}}
}

namespace PR45521 {
struct a { template<class b> a(const b * const&); };
int *d;
const a &r = d;
}
10 changes: 10 additions & 0 deletions clang/test/SemaCXX/warn-cast-align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ void test1(void *P) {
c = IntPtr(P);
}

struct __attribute__((aligned(16))) AlignedS {
char m[16];
};

struct __attribute__((aligned(16))) A {
char m0[16];
char m1[16];
AlignedS *getAlignedS() {
return (AlignedS *)m1;
}
};

struct B0 {
Expand Down Expand Up @@ -92,6 +99,9 @@ struct __attribute__((aligned(16))) D4 : virtual D2 {

struct D5 : virtual D0 {
char m0[16];
AlignedS *get() {
return (AlignedS *)m0; // expected-warning {{cast from 'char *' to 'AlignedS *'}}
}
};

struct D6 : virtual D5 {
Expand Down
4 changes: 0 additions & 4 deletions compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,9 @@ set(hexagon_SOURCES
hexagon/dfsqrt.S
hexagon/divdi3.S
hexagon/divsi3.S
hexagon/fabs_opt.S
hexagon/fastmath2_dlib_asm.S
hexagon/fastmath2_ldlib_asm.S
hexagon/fastmath_dlib_asm.S
hexagon/fma_opt.S
hexagon/fmax_opt.S
hexagon/fmin_opt.S
hexagon/memcpy_forward_vp4cp4n2.S
hexagon/memcpy_likely_aligned.S
hexagon/moddi3.S
Expand Down
8 changes: 3 additions & 5 deletions compiler-rt/lib/builtins/hexagon/dffma.S
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,11 @@
.type __hexagon_fmadf4,@function
.global __hexagon_fmadf5
.type __hexagon_fmadf5,@function
.global fma
.type fma,@function
Q6_ALIAS(fmadf5)
.p2align 5
__hexagon_fmadf4:
__hexagon_fmadf5:
fma:
.Lfma_begin:
{
P_TMP = dfclass(A,#2)
P_TMP = dfclass(B,#2)
Expand Down Expand Up @@ -561,15 +559,15 @@ fma:
B = insert(BTMP,#63,#0)
AH -= asl(TMP,#HI_MANTBITS)
}
jump fma
jump .Lfma_begin

.Lfma_ab_tiny:
ATMP = combine(##0x00100000,#0)
{
A = insert(ATMP,#63,#0)
B = insert(ATMP,#63,#0)
}
jump fma
jump .Lfma_begin

.Lab_inf:
{
Expand Down
36 changes: 0 additions & 36 deletions compiler-rt/lib/builtins/hexagon/fabs_opt.S

This file was deleted.

30 changes: 0 additions & 30 deletions compiler-rt/lib/builtins/hexagon/fma_opt.S

This file was deleted.

29 changes: 0 additions & 29 deletions compiler-rt/lib/builtins/hexagon/fmax_opt.S

This file was deleted.

29 changes: 0 additions & 29 deletions compiler-rt/lib/builtins/hexagon/fmin_opt.S

This file was deleted.

2 changes: 1 addition & 1 deletion flang/include/flang/Evaluate/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class DynamicType {
DynamicType ResultTypeForMultiply(const DynamicType &) const;

bool IsAssumedLengthCharacter() const;
bool IsUnknownLengthCharacter() const;
bool IsNonConstantLengthCharacter() const;
bool IsTypelessIntrinsicArgument() const;
constexpr bool IsAssumedType() const { // TYPE(*)
return kind_ == AssumedTypeKind;
Expand Down
4 changes: 3 additions & 1 deletion flang/lib/Evaluate/fold-integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,9 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldOperation(
if (iter != scope->end()) {
const Symbol &symbol{*iter->second};
const auto *details{symbol.detailsIf<semantics::TypeParamDetails>()};
if (details && details->init()) {
if (details && details->init() &&
(details->attr() == common::TypeParamAttr::Kind ||
IsConstantExpr(*details->init()))) {
Expr<SomeInteger> expr{*details->init()};
return Fold(context,
Expr<IntKIND>{
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Evaluate/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ auto GetLowerBoundHelper::operator()(const Symbol &symbol0) -> Result {
if (j++ == dimension_) {
if (const auto &bound{shapeSpec.lbound().GetExplicit()}) {
return Fold(context_, common::Clone(*bound));
} else if (semantics::IsDescriptor(symbol)) {
} else if (IsDescriptor(symbol)) {
return ExtentExpr{DescriptorInquiry{NamedEntity{symbol0},
DescriptorInquiry::Field::LowerBound, dimension_}};
} else {
Expand All @@ -230,7 +230,7 @@ auto GetLowerBoundHelper::operator()(const Component &component) -> Result {
if (j++ == dimension_) {
if (const auto &bound{shapeSpec.lbound().GetExplicit()}) {
return Fold(context_, common::Clone(*bound));
} else if (semantics::IsDescriptor(symbol)) {
} else if (IsDescriptor(symbol)) {
return ExtentExpr{
DescriptorInquiry{NamedEntity{common::Clone(component)},
DescriptorInquiry::Field::LowerBound, dimension_}};
Expand Down
Loading

0 comments on commit 233f5f4

Please sign in to comment.