Index: projects/clang380-import/contrib/llvm/patches/patch-04-clang-add-mips-triples.diff =================================================================== --- projects/clang380-import/contrib/llvm/patches/patch-04-clang-add-mips-triples.diff (revision 292943) +++ projects/clang380-import/contrib/llvm/patches/patch-04-clang-add-mips-triples.diff (nonexistent) @@ -1,33 +0,0 @@ -Allow clang to be built for mips/mips64 backend types by adding our mips -triple ids - -This only allows testing and does not change the defaults for mips/mips64. -They still build/use gcc by default. - -Differential Revision: https://reviews.freebsd.org/D1190 -Reviewed by: dim - -Introduced here: http://svnweb.freebsd.org/changeset/base/277423 - -Index: tools/clang/lib/Driver/Tools.cpp -=================================================================== ---- tools/clang/lib/Driver/Tools.cpp -+++ tools/clang/lib/Driver/Tools.cpp -@@ -6652,6 +6652,17 @@ void freebsd::Link::ConstructJob(Compilation &C, c - CmdArgs.push_back("elf32ppc_fbsd"); - } - -+ if (Arg *A = Args.getLastArg(options::OPT_G)) { -+ if (ToolChain.getArch() == llvm::Triple::mips || -+ ToolChain.getArch() == llvm::Triple::mipsel || -+ ToolChain.getArch() == llvm::Triple::mips64 || -+ ToolChain.getArch() == llvm::Triple::mips64el) { -+ StringRef v = A->getValue(); -+ CmdArgs.push_back(Args.MakeArgString("-G" + v)); -+ A->claim(); -+ } -+ } -+ - if (Output.isFilename()) { - CmdArgs.push_back("-o"); - CmdArgs.push_back(Output.getFilename()); Index: projects/clang380-import/contrib/llvm/patches/patch-03-enable-armv6-clrex.diff =================================================================== --- projects/clang380-import/contrib/llvm/patches/patch-03-enable-armv6-clrex.diff (revision 292943) +++ projects/clang380-import/contrib/llvm/patches/patch-03-enable-armv6-clrex.diff (nonexistent) @@ -1,20 +0,0 @@ -For now, enable the clrex instruction for armv6, until upstream -implements this properly. - -Submitted by: rdivacky - -Introduced here: http://svnweb.freebsd.org/changeset/base/275362 - -Index: lib/Target/ARM/ARMInstrInfo.td -=================================================================== ---- lib/Target/ARM/ARMInstrInfo.td -+++ lib/Target/ARM/ARMInstrInfo.td -@@ -4640,7 +4640,7 @@ def STLEXD : AIstlex<0b01, (outs GPR:$Rd), - - def CLREX : AXI<(outs), (ins), MiscFrm, NoItinerary, "clrex", - [(int_arm_clrex)]>, -- Requires<[IsARM, HasV7]> { -+ Requires<[IsARM, HasV6]> { - let Inst{31-0} = 0b11110101011111111111000000011111; - } - Index: projects/clang380-import/contrib/llvm/patches/patch-06-llvm-r248439-fdiv-hoisting.diff =================================================================== --- projects/clang380-import/contrib/llvm/patches/patch-06-llvm-r248439-fdiv-hoisting.diff (revision 292943) +++ projects/clang380-import/contrib/llvm/patches/patch-06-llvm-r248439-fdiv-hoisting.diff (nonexistent) @@ -1,83 +0,0 @@ -Pull in r248439 from upstream llvm trunk (by Sanjay Patel): - - set div/rem default values to 'expensive' in TargetTransformInfo's - cost model - - ...because that's what the cost model was intended to do. - - As discussed in D12882, this fix has a temporary unintended - consequence for SimplifyCFG: it causes us to not speculate an fdiv. - However, two wrongs make PR24818 right, and two wrongs make PR24343 - act right even though it's really still wrong. - - I intend to correct SimplifyCFG and add to CodeGenPrepare to account - for this cost model change and preserve the righteousness for the bug - report cases. - - https://llvm.org/bugs/show_bug.cgi?id=24818 - https://llvm.org/bugs/show_bug.cgi?id=24343 - - Differential Revision: http://reviews.llvm.org/D12882 - -This fixes the too-eager fdiv hoisting in pow(), which could lead to -unexpected floating point exceptions. - -Introduced here: http://svnweb.freebsd.org/changeset/base/288195 - -Index: include/llvm/Analysis/TargetTransformInfoImpl.h -=================================================================== ---- include/llvm/Analysis/TargetTransformInfoImpl.h -+++ include/llvm/Analysis/TargetTransformInfoImpl.h -@@ -60,6 +60,14 @@ class TargetTransformInfoImplBase { - // Otherwise, the default basic cost is used. - return TTI::TCC_Basic; - -+ case Instruction::FDiv: -+ case Instruction::FRem: -+ case Instruction::SDiv: -+ case Instruction::SRem: -+ case Instruction::UDiv: -+ case Instruction::URem: -+ return TTI::TCC_Expensive; -+ - case Instruction::IntToPtr: { - // An inttoptr cast is free so long as the input is a legal integer type - // which doesn't contain values outside the range of a pointer. -Index: test/Transforms/SimplifyCFG/speculate-math.ll -=================================================================== ---- test/Transforms/SimplifyCFG/speculate-math.ll -+++ test/Transforms/SimplifyCFG/speculate-math.ll -@@ -7,6 +7,33 @@ declare float @llvm.fabs.f32(float) nounwind reado - declare float @llvm.minnum.f32(float, float) nounwind readonly - declare float @llvm.maxnum.f32(float, float) nounwind readonly - -+; FIXME: This is intended to be a temporary test. As discussed in -+; D12882, we actually do want to speculate even expensive operations -+; in SimplifyCFG because it can expose more optimizations for other -+; passes. Therefore, we either need to adjust SimplifyCFG's -+; calculations that use the TTI cost model or use a different cost -+; model for deciding which ops should be speculated in SimplifyCFG. -+; We should also be using the TTI cost model later - for example in -+; CodeGenPrepare - to potentially undo this speculation. -+ -+; Do not speculate fdiv by default because it is generally expensive. -+ -+; CHECK-LABEL: @fdiv_test( -+; CHECK-NOT: select -+define double @fdiv_test(double %a, double %b) { -+entry: -+ %cmp = fcmp ogt double %a, 0.0 -+ br i1 %cmp, label %cond.true, label %cond.end -+ -+cond.true: -+ %div = fdiv double %b, %a -+ br label %cond.end -+ -+cond.end: -+ %cond = phi double [ %div, %cond.true ], [ 0.0, %entry ] -+ ret double %cond -+} -+ - ; CHECK-LABEL: @sqrt_test( - ; CHECK: select - define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { Index: projects/clang380-import/contrib/llvm/patches/patch-05-clang-r244063-missing-atomic-libcall.diff =================================================================== --- projects/clang380-import/contrib/llvm/patches/patch-05-clang-r244063-missing-atomic-libcall.diff (revision 292943) +++ projects/clang380-import/contrib/llvm/patches/patch-05-clang-r244063-missing-atomic-libcall.diff (nonexistent) @@ -1,229 +0,0 @@ -Pull in r244063 from upstream clang trunk (by James Y Knight): - - Add missing atomic libcall support. - - Support for emitting libcalls for __atomic_fetch_nand and - __atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some - test cases. - - Differential Revision: http://reviews.llvm.org/D10847 - -This fixes "cannot compile this atomic library call yet" errors when -compiling code which calls the above builtins, on arm < v6. - -Introduced here: http://svnweb.freebsd.org/changeset/base/288127 - -Index: tools/clang/docs/LanguageExtensions.rst -=================================================================== ---- tools/clang/docs/LanguageExtensions.rst -+++ tools/clang/docs/LanguageExtensions.rst -@@ -1715,6 +1715,9 @@ The macros ``__ATOMIC_RELAXED``, ``__ATOMIC_CONSUM - provided, with values corresponding to the enumerators of C11's - ``memory_order`` enumeration. - -+(Note that Clang additionally provides GCC-compatible ``__atomic_*`` -+builtins) -+ - Low-level ARM exclusive memory builtins - --------------------------------------- - -Index: tools/clang/lib/CodeGen/CGAtomic.cpp -=================================================================== ---- tools/clang/lib/CodeGen/CGAtomic.cpp -+++ tools/clang/lib/CodeGen/CGAtomic.cpp -@@ -699,7 +699,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr - - switch (E->getOp()) { - case AtomicExpr::AO__c11_atomic_init: -- llvm_unreachable("Already handled!"); -+ llvm_unreachable("Already handled above with EmitAtomicInit!"); - - case AtomicExpr::AO__c11_atomic_load: - case AtomicExpr::AO__atomic_load_n: -@@ -785,6 +785,9 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr - if (UseLibcall) { - bool UseOptimizedLibcall = false; - switch (E->getOp()) { -+ case AtomicExpr::AO__c11_atomic_init: -+ llvm_unreachable("Already handled above with EmitAtomicInit!"); -+ - case AtomicExpr::AO__c11_atomic_fetch_add: - case AtomicExpr::AO__atomic_fetch_add: - case AtomicExpr::AO__c11_atomic_fetch_and: -@@ -791,14 +794,34 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr - case AtomicExpr::AO__atomic_fetch_and: - case AtomicExpr::AO__c11_atomic_fetch_or: - case AtomicExpr::AO__atomic_fetch_or: -+ case AtomicExpr::AO__atomic_fetch_nand: - case AtomicExpr::AO__c11_atomic_fetch_sub: - case AtomicExpr::AO__atomic_fetch_sub: - case AtomicExpr::AO__c11_atomic_fetch_xor: - case AtomicExpr::AO__atomic_fetch_xor: -+ case AtomicExpr::AO__atomic_add_fetch: -+ case AtomicExpr::AO__atomic_and_fetch: -+ case AtomicExpr::AO__atomic_nand_fetch: -+ case AtomicExpr::AO__atomic_or_fetch: -+ case AtomicExpr::AO__atomic_sub_fetch: -+ case AtomicExpr::AO__atomic_xor_fetch: - // For these, only library calls for certain sizes exist. - UseOptimizedLibcall = true; - break; -- default: -+ -+ case AtomicExpr::AO__c11_atomic_load: -+ case AtomicExpr::AO__c11_atomic_store: -+ case AtomicExpr::AO__c11_atomic_exchange: -+ case AtomicExpr::AO__c11_atomic_compare_exchange_weak: -+ case AtomicExpr::AO__c11_atomic_compare_exchange_strong: -+ case AtomicExpr::AO__atomic_load_n: -+ case AtomicExpr::AO__atomic_load: -+ case AtomicExpr::AO__atomic_store_n: -+ case AtomicExpr::AO__atomic_store: -+ case AtomicExpr::AO__atomic_exchange_n: -+ case AtomicExpr::AO__atomic_exchange: -+ case AtomicExpr::AO__atomic_compare_exchange_n: -+ case AtomicExpr::AO__atomic_compare_exchange: - // Only use optimized library calls for sizes for which they exist. - if (Size == 1 || Size == 2 || Size == 4 || Size == 8) - UseOptimizedLibcall = true; -@@ -820,6 +843,9 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr - QualType RetTy; - bool HaveRetTy = false; - switch (E->getOp()) { -+ case AtomicExpr::AO__c11_atomic_init: -+ llvm_unreachable("Already handled!"); -+ - // There is only one libcall for compare an exchange, because there is no - // optimisation benefit possible from a libcall version of a weak compare - // and exchange. -@@ -903,7 +929,49 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr - AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, - E->getExprLoc(), sizeChars); - break; -- default: return EmitUnsupportedRValue(E, "atomic library call"); -+ // T __atomic_fetch_nand_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_fetch_nand: -+ LibCallName = "__atomic_fetch_nand"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ -+ // T __atomic_add_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_add_fetch: -+ LibCallName = "__atomic_add_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, LoweredMemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ // T __atomic_and_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_and_fetch: -+ LibCallName = "__atomic_and_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ // T __atomic_or_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_or_fetch: -+ LibCallName = "__atomic_or_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ // T __atomic_sub_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_sub_fetch: -+ LibCallName = "__atomic_sub_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, LoweredMemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ // T __atomic_xor_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_xor_fetch: -+ LibCallName = "__atomic_xor_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, -+ E->getExprLoc(), sizeChars); -+ break; -+ // T __atomic_nand_fetch_N(T *mem, T val, int order) -+ case AtomicExpr::AO__atomic_nand_fetch: -+ LibCallName = "__atomic_nand_fetch"; -+ AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy, -+ E->getExprLoc(), sizeChars); -+ break; - } - - // Optimized functions have the size in their name. -Index: tools/clang/test/CodeGen/atomic-ops-libcall.c -=================================================================== ---- tools/clang/test/CodeGen/atomic-ops-libcall.c -+++ tools/clang/test/CodeGen/atomic-ops-libcall.c -@@ -35,3 +35,75 @@ int *fp2a(int **p) { - // Note, the GNU builtins do not multiply by sizeof(T)! - return __atomic_fetch_sub(p, 4, memory_order_relaxed); - } -+ -+int test_atomic_fetch_add(int *p) { -+ // CHECK: test_atomic_fetch_add -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_add_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_add(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_fetch_sub(int *p) { -+ // CHECK: test_atomic_fetch_sub -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_sub_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_sub(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_fetch_and(int *p) { -+ // CHECK: test_atomic_fetch_and -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_and_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_and(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_fetch_or(int *p) { -+ // CHECK: test_atomic_fetch_or -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_or_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_or(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_fetch_xor(int *p) { -+ // CHECK: test_atomic_fetch_xor -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_xor_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_xor(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_fetch_nand(int *p) { -+ // CHECK: test_atomic_fetch_nand -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_nand_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_fetch_nand(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_add_fetch(int *p) { -+ // CHECK: test_atomic_add_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_add_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_add_fetch(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_sub_fetch(int *p) { -+ // CHECK: test_atomic_sub_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_sub_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_sub_fetch(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_and_fetch(int *p) { -+ // CHECK: test_atomic_and_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_and_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_and_fetch(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_or_fetch(int *p) { -+ // CHECK: test_atomic_or_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_or_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_or_fetch(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_xor_fetch(int *p) { -+ // CHECK: test_atomic_xor_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_xor_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_xor_fetch(p, 55, memory_order_seq_cst); -+} -+ -+int test_atomic_nand_fetch(int *p) { -+ // CHECK: test_atomic_nand_fetch -+ // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_nand_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) -+ return __atomic_nand_fetch(p, 55, memory_order_seq_cst); -+} Index: projects/clang380-import/contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff =================================================================== --- projects/clang380-import/contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff (revision 292943) +++ projects/clang380-import/contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff (nonexistent) @@ -1,21 +0,0 @@ -In assembler mode, clang defaulted to DWARF3, if only -g was specified. -Change this to DWARF2, in the simplest way possible. (Upstream, this -was fixed in clang trunk r250173, but this was done along with a lot of -shuffling around of debug option handling, so it cannot be applied -as-is.) - -Introduced here: https://svnweb.freebsd.org/changeset/base/291701 - -Index: tools/clang/tools/driver/cc1as_main.cpp -=================================================================== ---- tools/clang/tools/driver/cc1as_main.cpp -+++ tools/clang/tools/driver/cc1as_main.cpp -@@ -141,7 +141,7 @@ struct AssemblerInvocation { - RelaxAll = 0; - NoExecStack = 0; - FatalWarnings = 0; -- DwarfVersion = 3; -+ DwarfVersion = 2; - } - - static bool CreateFromArgs(AssemblerInvocation &Res,