Skip to content

Commit

Permalink
Merged master:c20c1960c15 into amd-gfx:fc4a32150a5
Browse files Browse the repository at this point in the history
Local branch amd-gfx fc4a321 Merged master:fbef6c55bc2 into amd-gfx:c981d60f027
Remote branch master c20c196 Add Python bindings guide.
  • Loading branch information
Sw authored and Sw committed Jul 10, 2020
2 parents fc4a321 + c20c196 commit 3377900
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 10 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticFrontendKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def warn_fe_serialized_diag_merge_failure : Warning<
def warn_fe_serialized_diag_failure : Warning<
"unable to open file %0 for serializing diagnostics (%1)">,
InGroup<SerializedDiagnostics>;
def warn_fe_serialized_diag_failure_during_finalisation : Warning<
"Received warning after diagnostic serialization teardown was underway: %0">,
InGroup<SerializedDiagnostics>;

def err_verify_missing_line : Error<
"missing or invalid line number following '@' in expected %0">;
Expand Down
25 changes: 25 additions & 0 deletions clang/lib/Frontend/SerializedDiagnosticPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ class SDiagsWriter : public DiagnosticConsumer {
/// generated from child processes.
bool MergeChildRecords;

/// Whether we've started finishing and tearing down this instance.
bool IsFinishing = false;

/// State that is shared among the various clones of this diagnostic
/// consumer.
struct SharedState {
Expand Down Expand Up @@ -568,6 +571,17 @@ unsigned SDiagsWriter::getEmitDiagnosticFlag(StringRef FlagName) {

void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info) {
assert(!IsFinishing &&
"Received a diagnostic after we've already started teardown.");
if (IsFinishing) {
SmallString<256> diagnostic;
Info.FormatDiagnostic(diagnostic);
getMetaDiags()->Report(
diag::warn_fe_serialized_diag_failure_during_finalisation)
<< diagnostic;
return;
}

// Enter the block for a non-note diagnostic immediately, rather than waiting
// for beginDiagnostic, in case associated notes are emitted before we get
// there.
Expand Down Expand Up @@ -761,6 +775,9 @@ void SDiagsWriter::RemoveOldDiagnostics() {
}

void SDiagsWriter::finish() {
assert(!IsFinishing);
IsFinishing = true;

// The original instance is responsible for writing the file.
if (!OriginalInstance)
return;
Expand All @@ -786,12 +803,20 @@ void SDiagsWriter::finish() {
if (EC) {
getMetaDiags()->Report(diag::warn_fe_serialized_diag_failure)
<< State->OutputFile << EC.message();
OS->clear_error();
return;
}

// Write the generated bitstream to "Out".
OS->write((char *)&State->Buffer.front(), State->Buffer.size());
OS->flush();

assert(!OS->has_error());
if (OS->has_error()) {
getMetaDiags()->Report(diag::warn_fe_serialized_diag_failure)
<< State->OutputFile << OS->error().message();
OS->clear_error();
}
}

std::error_code SDiagsMerger::visitStartOfDiagnostic() {
Expand Down
2 changes: 2 additions & 0 deletions libcxxabi/src/demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5096,6 +5096,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() {
// ::= <special-name>
template <typename Derived, typename Alloc>
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
ScopedTemplateParamList EncodingTemplateParams(this);

if (look() == 'G' || look() == 'T')
return getDerived().parseSpecialName();

Expand Down
10 changes: 10 additions & 0 deletions libcxxabi/test/test_demangle.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29792,6 +29792,16 @@ const char* cases[][2] =
// "auto inline_func()::'lambda'<int, int>(int, int) const"
{"_ZZ11inline_funcvENKUlTyTyT_T0_E_clIiiEEDaS_S0_", "auto inline_func()::'lambda'<typename $T, typename $T0>($T, $T0)::operator()<int, int>($T, $T0) const"},
{"_ZZ11inline_funcvENKUlTyTyT_T1_T0_E_clIiiiEEDaS_S0_S1_", "auto inline_func()::'lambda'<typename $T, typename $T0>($T, auto, $T0)::operator()<int, int, int>($T, auto, $T0) const"},
{"_ZN1XIZ1fIiEvOT_EUlOT_DpT0_E_EclIJEEEvDpT_", "void X<void f<int>(int&&)::'lambda'(auto&&, auto...)>::operator()<>()"},
// FIXME: This is wrong, should demangle to the same as the previous entry.
// See https://github.com/itanium-cxx-abi/cxx-abi/issues/106.
{"_ZN1XIZ1fIiEvOT_EUlS2_DpT0_E_EclIJEEEvDpT_", "void X<void f<int>(int&&)::'lambda'(int&&, auto...)>::operator()<>()"},

// FIXME: This is wrong; the S2_ backref should expand to OT_ and then to
// "double&&". But we can't cope with a substitution that represents a
// different type the node it is a substitute for.
// See https://github.com/itanium-cxx-abi/cxx-abi/issues/106.
{"_Z1h1XIJZ1fIiEDaOT_E1AZ1gIdEDaS2_E1BEE", "h(X<auto f<int>(int&&)::A, auto g<double>(int&&)::B>)"},

{"_Z1fIL4Enumn1EEvv", "void f<(Enum)-1>()"},

Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5096,6 +5096,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() {
// ::= <special-name>
template <typename Derived, typename Alloc>
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
ScopedTemplateParamList EncodingTemplateParams(this);

if (look() == 'G' || look() == 'T')
return getDerived().parseSpecialName();

Expand Down
8 changes: 6 additions & 2 deletions llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,12 @@ PHINode *WidenIV::createWideIV(SCEVExpander &Rewriter) {
// either find an existing phi or materialize a new one. Either way, we
// expect a well-formed cyclic phi-with-increments. i.e. any operand not part
// of the phi-SCC dominates the loop entry.
Instruction *InsertPt = &L->getHeader()->front();
WidePhi = cast<PHINode>(Rewriter.expandCodeFor(AddRec, WideType, InsertPt));
Instruction *InsertPt = &*L->getHeader()->getFirstInsertionPt();
WidePhi = dyn_cast<PHINode>(Rewriter.expandCodeFor(AddRec, WideType, InsertPt));
// If the wide phi is not a phi node, for example a cast node, like bitcast,
// inttoptr, ptrtoint, just skip for now.
if (!WidePhi)
return nullptr;

// Remembering the WideIV increment generated by SCEVExpander allows
// widenIVUse to reuse it when widening the narrow IV's increment. We don't
Expand Down
14 changes: 6 additions & 8 deletions llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,8 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
if (useSubtract)
Step = SE.getNegativeSCEV(Step);
// Expand the step somewhere that dominates the loop header.
Value *StepV = expandCodeFor(Step, IntTy, &L->getHeader()->front());
Value *StepV = expandCodeFor(Step, IntTy,
&*L->getHeader()->getFirstInsertionPt());

// The no-wrap behavior proved by IsIncrement(NUW|NSW) is only applicable if
// we actually do emit an addition. It does not apply if we emit a
Expand Down Expand Up @@ -1438,7 +1439,8 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) {
{
// Expand the step somewhere that dominates the loop header.
SCEVInsertPointGuard Guard(Builder, this);
StepV = expandCodeFor(Step, IntTy, &L->getHeader()->front());
StepV = expandCodeFor(Step, IntTy,
&*L->getHeader()->getFirstInsertionPt());
}
Result = expandIVInc(PN, StepV, L, ExpandTy, IntTy, useSubtract);
}
Expand Down Expand Up @@ -1870,11 +1872,6 @@ Value *SCEVExpander::expand(const SCEV *S) {
}
}

// IndVarSimplify sometimes sets the insertion point at the block start, even
// when there are PHIs at that point. We must correct for this.
if (isa<PHINode>(*InsertPt))
InsertPt = &*InsertPt->getParent()->getFirstInsertionPt();

// Check to see if we already expanded this here.
auto I = InsertedExpressions.find(std::make_pair(S, InsertPt));
if (I != InsertedExpressions.end())
Expand Down Expand Up @@ -1945,7 +1942,8 @@ SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L,
// Emit code for it.
SCEVInsertPointGuard Guard(Builder, this);
PHINode *V =
cast<PHINode>(expandCodeFor(H, nullptr, &L->getHeader()->front()));
cast<PHINode>(expandCodeFor(H, nullptr,
&*L->getHeader()->getFirstInsertionPt()));

return V;
}
Expand Down
24 changes: 24 additions & 0 deletions llvm/test/Transforms/IndVarSimplify/widen-i32-i8ptr.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
; RUN: opt < %s -indvars -S | FileCheck %s

target datalayout = "e-m:e-i64:64-n32:64"

define dso_local void @Widen_i32_i8ptr() local_unnamed_addr {
; CHECK-LABEL: @Widen_i32_i8ptr(
; CHECK: phi i8*
; CHECK: phi i32
entry:
%ptrids = alloca [15 x i8*], align 8
%arraydecay2032 = getelementptr inbounds [15 x i8*], [15 x i8*]* %ptrids, i64 0, i64 0
store i8** %arraydecay2032, i8*** inttoptr (i64 8 to i8***), align 8
br label %for.cond2106

for.cond2106: ; preds = %for.cond2106, %entry
%gid.0 = phi i8* [ null, %entry ], [ %incdec.ptr, %for.cond2106 ]
%i.0 = phi i32 [ 0, %entry ], [ %inc2117, %for.cond2106 ]
%incdec.ptr = getelementptr inbounds i8, i8* %gid.0, i64 1
%idxprom2114 = zext i32 %i.0 to i64
%arrayidx2115 = getelementptr inbounds [15 x i8*], [15 x i8*]* %ptrids, i64 0, i64 %idxprom2114
store i8* %gid.0, i8** %arrayidx2115, align 8
%inc2117 = add nuw nsw i32 %i.0, 1
br label %for.cond2106
}
Loading

0 comments on commit 3377900

Please sign in to comment.