[llvm-branch-commits] [llvm-branch] r252774 - Merging r247461:
Author: tstellar Date: Wed Nov 11 12:41:49 2015 New Revision: 252774 URL: http://llvm.org/viewvc/llvm-project?rev=252774&view=rev Log: Merging r247461: r247461 | Yunzhong_Gao | 2015-09-11 16:01:53 -0400 (Fri, 11 Sep 2015) | 4 lines Add a non-exiting diagnostic handler for LTO. This is in order to give LTO clients a chance to do some clean-up before terminating the process. Added: llvm/branches/release_37/test/LTO/X86/diagnostic-handler-noexit.ll Modified: llvm/branches/release_37/lib/LTO/LTOCodeGenerator.cpp llvm/branches/release_37/tools/llvm-lto/llvm-lto.cpp Modified: llvm/branches/release_37/lib/LTO/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/LTO/LTOCodeGenerator.cpp?rev=252774&r1=252773&r2=252774&view=diff == --- llvm/branches/release_37/lib/LTO/LTOCodeGenerator.cpp (original) +++ llvm/branches/release_37/lib/LTO/LTOCodeGenerator.cpp Wed Nov 11 12:41:49 2015 @@ -63,14 +63,21 @@ const char* LTOCodeGenerator::getVersion #endif } +static void handleLTODiagnostic(const DiagnosticInfo &DI) { + DiagnosticPrinterRawOStream DP(errs()); + DI.print(DP); + errs() << "\n"; +} + LTOCodeGenerator::LTOCodeGenerator() -: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context)) { +: Context(getGlobalContext()), IRLinker(new Module("ld-temp.o", Context), +handleLTODiagnostic) { initializeLTOPasses(); } LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr Context) : OwnedContext(std::move(Context)), Context(*OwnedContext), - IRLinker(new Module("ld-temp.o", *OwnedContext)) { + IRLinker(new Module("ld-temp.o", *OwnedContext), handleLTODiagnostic) { initializeLTOPasses(); } Added: llvm/branches/release_37/test/LTO/X86/diagnostic-handler-noexit.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/test/LTO/X86/diagnostic-handler-noexit.ll?rev=252774&view=auto == --- llvm/branches/release_37/test/LTO/X86/diagnostic-handler-noexit.ll (added) +++ llvm/branches/release_37/test/LTO/X86/diagnostic-handler-noexit.ll Wed Nov 11 12:41:49 2015 @@ -0,0 +1,13 @@ +; LTO default diagnostic handler should be non-exiting. +; This test verifies that after addModule() encounters an error, the diagnostic +; handler does not call exit(1) and instead returns to the caller of addModule. + +; RUN: llvm-as <%s >%t1 +; RUN: llvm-as <%s >%t2 +; RUN: not llvm-lto -o /dev/null %t1 %t2 2>&1 | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" + +; CHECK: Linking globals named 'goodboy': symbol multiply defined! +; CHECK: llvm-lto{{.*}}: error adding file +@goodboy = global i32 3203383023, align 4; 0xbeefbeef Modified: llvm/branches/release_37/tools/llvm-lto/llvm-lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/tools/llvm-lto/llvm-lto.cpp?rev=252774&r1=252773&r2=252774&view=diff == --- llvm/branches/release_37/tools/llvm-lto/llvm-lto.cpp (original) +++ llvm/branches/release_37/tools/llvm-lto/llvm-lto.cpp Wed Nov 11 12:41:49 2015 @@ -214,8 +214,11 @@ int main(int argc, char **argv) { if (SetMergedModule && i == BaseArg) { // Transfer ownership to the code generator. CodeGen.setModule(Module.release()); -} else if (!CodeGen.addModule(Module.get())) +} else if (!CodeGen.addModule(Module.get())) { + // Print a message here so that we know addModule() did not abort. + errs() << argv[0] << ": error adding file '" << InputFilenames[i] << "'\n"; return 1; +} unsigned NumSyms = LTOMod->getSymbolCount(); for (unsigned I = 0; I < NumSyms; ++I) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-branch] r252802 - Merging r249854:
Author: tstellar Date: Wed Nov 11 15:00:37 2015 New Revision: 252802 URL: http://llvm.org/viewvc/llvm-project?rev=252802&view=rev Log: Merging r249854: r249854 | kfischer | 2015-10-09 13:24:54 -0400 (Fri, 09 Oct 2015) | 11 lines Clear SectionSymbols in MCContext::Reset This was just forgotten when SectionSymbols was introduced and could cause corruption if the MCContext was reused after Reset. Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13547 Modified: llvm/branches/release_37/lib/MC/MCContext.cpp Modified: llvm/branches/release_37/lib/MC/MCContext.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/MC/MCContext.cpp?rev=252802&r1=252801&r2=252802&view=diff == --- llvm/branches/release_37/lib/MC/MCContext.cpp (original) +++ llvm/branches/release_37/lib/MC/MCContext.cpp Wed Nov 11 15:00:37 2015 @@ -82,6 +82,7 @@ void MCContext::reset() { UsedNames.clear(); Symbols.clear(); + SectionSymbols.clear(); Allocator.Reset(); Instances.clear(); CompilationDir.clear(); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r252808 - Merging r246882:
Author: tstellar Date: Wed Nov 11 15:45:36 2015 New Revision: 252808 URL: http://llvm.org/viewvc/llvm-project?rev=252808&view=rev Log: Merging r246882: r246882 | hfinkel | 2015-09-04 17:49:21 -0400 (Fri, 04 Sep 2015) | 32 lines Don't crash on a self-alias declaration We were crashing in CodeGen given input like this: int self_alias(void) __attribute__((weak, alias("self_alias"))); such a self-alias is invalid, but instead of diagnosing the situation, we'd proceed to produce IR for both the function declaration and the alias. Because we already had a function named 'self_alias', the alias could not be named the same thing, and so LLVM would pick a different name ('self_alias1' for example) for that value. When we later called CodeGenModule::checkAliases, we'd look up the IR value corresponding to the alias name, find the function declaration instead, and then assert in a cast to llvm::GlobalAlias. The easiest way to prevent this is simply to avoid creating the wrongly-named alias value in the first place and issue the diagnostic there (instead of in checkAliases). We detect a related cycle case in CodeGenModule::EmitAliasDefinition already, so this just adds a second such check. Even though the other test cases for this 'alias definition is part of a cycle' diagnostic are in test/Sema/attr-alias-elf.c, I've added a separate regression test for this case. This is because I can't add this check to test/Sema/attr-alias-elf.c without disturbing the other test cases in that file. In order to avoid construction of the bad IR values, this diagnostic is emitted from within CodeGenModule::EmitAliasDefinition (and the relevant declaration is not added to the Aliases vector). The other cycle checks are done within the CodeGenModule::checkAliases function based on the Aliases vector, called from CodeGenModule::Release. However, if there have been errors earlier, HandleTranslationUnit does not call Release, and so checkAliases is never called, and so none of the other diagnostics would be produced. Fixes PR23509. Added: cfe/branches/release_37/test/Sema/attr-self-alias.c Modified: cfe/branches/release_37/lib/CodeGen/CodeGenModule.cpp Modified: cfe/branches/release_37/lib/CodeGen/CodeGenModule.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/lib/CodeGen/CodeGenModule.cpp?rev=252808&r1=252807&r2=252808&view=diff == --- cfe/branches/release_37/lib/CodeGen/CodeGenModule.cpp (original) +++ cfe/branches/release_37/lib/CodeGen/CodeGenModule.cpp Wed Nov 11 15:45:36 2015 @@ -2493,6 +2493,11 @@ void CodeGenModule::EmitAliasDefinition( StringRef MangledName = getMangledName(GD); + if (AA->getAliasee() == MangledName) { +Diags.Report(AA->getLocation(), diag::err_cyclic_alias); +return; + } + // If there is a definition in the module, then it wins over the alias. // This is dubious, but allow it to be safe. Just ignore the alias. llvm::GlobalValue *Entry = GetGlobalValue(MangledName); Added: cfe/branches/release_37/test/Sema/attr-self-alias.c URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/Sema/attr-self-alias.c?rev=252808&view=auto == --- cfe/branches/release_37/test/Sema/attr-self-alias.c (added) +++ cfe/branches/release_37/test/Sema/attr-self-alias.c Wed Nov 11 15:45:36 2015 @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -triple x86_64-pc-linux -fsyntax-only -verify -emit-llvm-only %s + +int self_alias(void) __attribute__((weak, alias("self_alias"))); // expected-error {{alias definition is part of a cycle}} + ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r252844 - Merging r251930:
Author: tstellar Date: Wed Nov 11 19:57:22 2015 New Revision: 252844 URL: http://llvm.org/viewvc/llvm-project?rev=252844&view=rev Log: Merging r251930: r251930 | martellmalone | 2015-11-03 10:57:45 -0500 (Tue, 03 Nov 2015) | 6 lines Remove some legacy mingw-w64 gcc struct info As of gcc 4.7 mingw-w64 no longer emits 128-bit structs as i128 Differential Revision: http://reviews.llvm.org/D14179 Modified: cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp Modified: cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp?rev=252844&r1=252843&r2=252844&view=diff == --- cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp Wed Nov 11 19:57:22 2015 @@ -3071,10 +3071,6 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu if (RT->getDecl()->hasFlexibleArrayMember()) return ABIArgInfo::getIndirect(0, /*ByVal=*/false); -// FIXME: mingw-w64-gcc emits 128-bit struct as i128 -if (Width == 128 && getTarget().getTriple().isWindowsGNUEnvironment()) - return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(), - Width)); } // vectorcall adds the concept of a homogenous vector aggregate, similar to ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-branch] r252850 - Merging r245862:
Author: tstellar Date: Wed Nov 11 21:05:51 2015 New Revision: 252850 URL: http://llvm.org/viewvc/llvm-project?rev=252850&view=rev Log: Merging r245862: r245862 | wschmidt | 2015-08-24 15:27:27 -0400 (Mon, 24 Aug 2015) | 8 lines [PPC64LE] Fix PR24546 - Swap optimization and debug values This patch fixes PR24546, which demonstrates a segfault during the VSX swap removal pass. The problem is that debug value instructions were not excluded from the list of instructions to be analyzed for webs of related computation. I've added the test case from the PR as a crash test in test/CodeGen/PowerPC. Added: llvm/branches/release_37/test/CodeGen/PowerPC/pr24546.ll Modified: llvm/branches/release_37/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp Modified: llvm/branches/release_37/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp?rev=252850&r1=252849&r2=252850&view=diff == --- llvm/branches/release_37/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp (original) +++ llvm/branches/release_37/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp Wed Nov 11 21:05:51 2015 @@ -240,6 +240,9 @@ bool PPCVSXSwapRemoval::gatherVectorInst for (MachineBasicBlock &MBB : *MF) { for (MachineInstr &MI : MBB) { + if (MI.isDebugValue()) +continue; + bool RelevantInstr = false; bool Partial = false; Added: llvm/branches/release_37/test/CodeGen/PowerPC/pr24546.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/test/CodeGen/PowerPC/pr24546.ll?rev=252850&view=auto == --- llvm/branches/release_37/test/CodeGen/PowerPC/pr24546.ll (added) +++ llvm/branches/release_37/test/CodeGen/PowerPC/pr24546.ll Wed Nov 11 21:05:51 2015 @@ -0,0 +1,116 @@ +; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s + +; Verify that we no longer crash in VSX swap removal when debug values +; are in the code stream. + +@php_intpow10.powers = external unnamed_addr constant [23 x double], align 8 + +; Function Attrs: nounwind +define double @_php_math_round(double %value, i32 signext %places, i32 signext %mode) #0 { +entry: + br i1 undef, label %if.then, label %if.else, !dbg !32 + +if.then: ; preds = %entry + %conv = sitofp i32 undef to double, !dbg !34 + br i1 undef, label %if.then.i, label %if.end.i, !dbg !36 + +if.then.i:; preds = %if.then + %call.i = tail call double @pow(double 1.00e+01, double undef) #3, !dbg !39 + br label %php_intpow10.exit, !dbg !41 + +if.end.i: ; preds = %if.then + %0 = load double, double* undef, align 8, !dbg !42, !tbaa !43 + br label %php_intpow10.exit, !dbg !47 + +php_intpow10.exit:; preds = %if.end.i, %if.then.i + %retval.0.i = phi double [ %call.i, %if.then.i ], [ %0, %if.end.i ], !dbg !48 + tail call void @llvm.dbg.value(metadata double %retval.0.i, i64 0, metadata !15, metadata !49), !dbg !50 + %div = fdiv double %conv, %retval.0.i, !dbg !51 + br label %if.end.15, !dbg !52 + +if.else: ; preds = %entry + %mul = fmul double %value, undef, !dbg !53 + br label %if.end.15 + +if.end.15:; preds = %if.else, %php_intpow10.exit + %tmp_value.1 = phi double [ %div, %php_intpow10.exit ], [ %mul, %if.else ] + ret double %tmp_value.1, !dbg !57 +} + +declare signext i32 @php_intlog10abs(...) #1 + +declare signext i32 @php_round_helper(...) #1 + +; Function Attrs: nounwind +declare double @pow(double, double) #0 + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2 + +attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+power8-vector,+vsx,-qpx" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+power8-vector,+vsx,-qpx" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind readnone } +attributes #3 = { nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!29, !30} +!llvm.ident = !{