[llvm-branch-commits] [lld] f96ff3c - [ELF] --wrap: Produce a dynamic symbol for undefined __wrap_
Author: Fangrui Song Date: 2021-01-19T21:23:57-08:00 New Revision: f96ff3c0f8ebd941b3f6b345164c3d858b781484 URL: https://github.com/llvm/llvm-project/commit/f96ff3c0f8ebd941b3f6b345164c3d858b781484 DIFF: https://github.com/llvm/llvm-project/commit/f96ff3c0f8ebd941b3f6b345164c3d858b781484.diff LOG: [ELF] --wrap: Produce a dynamic symbol for undefined __wrap_ ``` // a.s jmp fcntl // b.s .globl fcntl fcntl: ret ``` `ld.lld -shared --wrap=fcntl a.o b.o` has an `R_X86_64_JUMP_SLOT` referencing the index 0 undefined symbol, which will cause a glibc `symbol lookup error` at runtime. This is because `__wrap_fcntl` is not in .dynsym We use an approximation `!wrap->isUndefined()`, which doesn't set `isUsedInRegularObj` of `__wrap_fcntl` when `fcntl` is referenced and `__wrap_fcntl` is undefined. Fix this by using `sym->referenced`. Added: Modified: lld/ELF/Driver.cpp lld/ELF/Symbols.h lld/test/ELF/wrap-shlib-undefined.s Removed: diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index e1395a568ea2..de613b5c9d19 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1922,7 +1922,7 @@ static std::vector addWrappedSymbols(opt::InputArgList &args) { // Tell LTO not to eliminate these symbols. sym->isUsedInRegularObj = true; -if (!wrap->isUndefined()) +if (sym->referenced) wrap->isUsedInRegularObj = true; } return v; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index bb87ac75f9c6..38c20d55bb08 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -132,9 +132,11 @@ class Symbol { // doesn't know the final contents of the symbol. uint8_t canInline : 1; - // Used by Undefined and SharedSymbol to track if there has been at least one - // undefined reference to the symbol. The binding may change to STB_WEAK if - // the first undefined reference from a non-shared object is weak. + // Used to track if there has been at least one undefined reference to the + // symbol. For Undefined and SharedSymbol, the binding may change to STB_WEAK + // if the first undefined reference from a non-shared object is weak. + // + // This is also used to retain __wrap_foo when foo is referenced. uint8_t referenced : 1; // True if this symbol is specified by --trace-symbol option. diff --git a/lld/test/ELF/wrap-shlib-undefined.s b/lld/test/ELF/wrap-shlib-undefined.s index acc9fd8b943e..f46ebe36b779 100644 --- a/lld/test/ELF/wrap-shlib-undefined.s +++ b/lld/test/ELF/wrap-shlib-undefined.s @@ -8,11 +8,12 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/wrap.s -o %t/wrap.o # RUN: ld.lld -shared --soname=fixed %t/wrap.o -o %t/wrap.so +## foo is defined, then referenced in another object file. # RUN: ld.lld -shared %t/main.o %t/call-foo.o --wrap foo -o %t1.so # RUN: llvm-readelf -r %t1.so | FileCheck %s --check-prefix=CHECK1 # CHECK1: R_X86_64_JUMP_SLOT bar + 0 -# CHECK1-NEXT: R_X86_64_JUMP_SLOT 0{{$}} +# CHECK1-NEXT: R_X86_64_JUMP_SLOT __wrap_foo + 0 ## --no-allow-shlib-undefined errors because __real_foo is not defined. # RUN: not ld.lld %t/main.o %t/bar.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s @@ -32,9 +33,10 @@ ## __wrap_bar is undefined. # RUN: ld.lld -shared %t.o --wrap=bar -o %t3.so # RUN: llvm-readelf -r --dyn-syms %t3.so | FileCheck %s --check-prefix=CHECK3 -# CHECK3: R_X86_64_JUMP_SLOT 0{{$}} -# CHECK3: Symbol table '.dynsym' contains 3 entries: +# CHECK3: R_X86_64_JUMP_SLOT __wrap_bar + 0 +# CHECK3: Symbol table '.dynsym' contains 4 entries: # CHECK3: NOTYPE LOCAL DEFAULT UND +# CHECK3-NEXT: NOTYPE GLOBAL DEFAULT UND __wrap_bar # CHECK3-NEXT: NOTYPE GLOBAL DEFAULT6 _start # CHECK3-NEXT: NOTYPE GLOBAL DEFAULT6 foo ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 8031785 - [ELF][test] Improve --wrap tests
Author: Fangrui Song Date: 2021-01-19T21:21:19-08:00 New Revision: 8031785f4a7ebd027edb34c91cbcf48db53ef444 URL: https://github.com/llvm/llvm-project/commit/8031785f4a7ebd027edb34c91cbcf48db53ef444 DIFF: https://github.com/llvm/llvm-project/commit/8031785f4a7ebd027edb34c91cbcf48db53ef444.diff LOG: [ELF][test] Improve --wrap tests Added: Modified: lld/test/ELF/wrap-shlib-undefined.s Removed: diff --git a/lld/test/ELF/wrap-shlib-undefined.s b/lld/test/ELF/wrap-shlib-undefined.s index eca21b91d866..acc9fd8b943e 100644 --- a/lld/test/ELF/wrap-shlib-undefined.s +++ b/lld/test/ELF/wrap-shlib-undefined.s @@ -1,28 +1,54 @@ # REQUIRES: x86 -# RUN: split-file %s %t.dir -# RUN: llvm-mc -filetype=obj -triple=x86_64 %t.dir/main.s -o %t.o -# RUN: echo '.globl bar; bar: call __real_foo' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o -# RUN: ld.lld -shared -soname=t.so %t1.o -o %t.so +# RUN: rm -rf %t && split-file %s %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t/main.o +# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/call-foo.s -o %t/call-foo.o +# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/bar.s -o %t/bar.o +# RUN: ld.lld -shared -soname=t.so %t/bar.o -o %t/bar.so +# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/wrap.s -o %t/wrap.o +# RUN: ld.lld -shared --soname=fixed %t/wrap.o -o %t/wrap.so + +# RUN: ld.lld -shared %t/main.o %t/call-foo.o --wrap foo -o %t1.so +# RUN: llvm-readelf -r %t1.so | FileCheck %s --check-prefix=CHECK1 + +# CHECK1: R_X86_64_JUMP_SLOT bar + 0 +# CHECK1-NEXT: R_X86_64_JUMP_SLOT 0{{$}} ## --no-allow-shlib-undefined errors because __real_foo is not defined. -# RUN: not ld.lld %t.o %t.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s +# RUN: not ld.lld %t/main.o %t/bar.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s # ERR: {{.*}}.so: undefined reference to __real_foo [--no-allow-shlib-undefined] ## --wrap=foo defines __real_foo. -# RUN: ld.lld %t.o %t.so --wrap=foo -o %t -# RUN: llvm-readelf --dyn-syms %t | FileCheck %s +# RUN: ld.lld %t/main.o %t/bar.so --wrap=foo -o %t2 +# RUN: llvm-readelf --dyn-syms %t2 | FileCheck %s --check-prefix=CHECK2 -## The reference __real_foo from %t.so causes foo to be exported. +## The reference __real_foo from %t/bar.so causes foo to be exported. ## __wrap_foo is not used, thus not exported. -# CHECK: Symbol table '.dynsym' contains 3 entries: -# CHECK: NOTYPE LOCAL DEFAULT UND -# CHECK-NEXT: NOTYPE GLOBAL DEFAULT UND bar -# CHECK-NEXT: NOTYPE GLOBAL DEFAULT6 foo - -# RUN: llvm-mc -filetype=obj -triple=x86_64 %t.dir/wrap.s -o %twrap.o -# RUN: ld.lld -shared --soname=fixed %twrap.o -o %twrap.so -# RUN: ld.lld %t.o %twrap.so --wrap bar -o %t1 +# CHECK2: Symbol table '.dynsym' contains 3 entries: +# CHECK2: NOTYPE LOCAL DEFAULT UND +# CHECK2-NEXT: NOTYPE GLOBAL DEFAULT UND bar +# CHECK2-NEXT: NOTYPE GLOBAL DEFAULT6 foo + +## __wrap_bar is undefined. +# RUN: ld.lld -shared %t.o --wrap=bar -o %t3.so +# RUN: llvm-readelf -r --dyn-syms %t3.so | FileCheck %s --check-prefix=CHECK3 +# CHECK3: R_X86_64_JUMP_SLOT 0{{$}} +# CHECK3: Symbol table '.dynsym' contains 3 entries: +# CHECK3: NOTYPE LOCAL DEFAULT UND +# CHECK3-NEXT: NOTYPE GLOBAL DEFAULT6 _start +# CHECK3-NEXT: NOTYPE GLOBAL DEFAULT6 foo + +## __wrap_bar is defined in %t/wrap.so. +# RUN: ld.lld -shared %t.o %t/wrap.so --wrap=bar -o %t4.so +# RUN: llvm-readelf -r --dyn-syms %t4.so | FileCheck %s --check-prefix=CHECK4 +# CHECK4: R_X86_64_JUMP_SLOT {{.*}} __wrap_bar + 0 +# CHECK4: Symbol table '.dynsym' contains 4 entries: +# CHECK4: NOTYPE LOCAL DEFAULT UND +# CHECK4-NEXT: NOTYPE GLOBAL DEFAULT UND __wrap_bar +# CHECK4-NEXT: NOTYPE GLOBAL DEFAULT6 _start +# CHECK4-NEXT: NOTYPE GLOBAL DEFAULT6 foo + +# RUN: ld.lld %t.o %t/wrap.so --wrap bar -o %t1 # RUN: llvm-readelf --dyn-syms %t1 | FileCheck %s --check-prefix=DYNSYM # RUN: llvm-objdump -d %t1 | FileCheck %s --check-prefix=ASM @@ -39,6 +65,14 @@ _start: call bar foo: +#--- call-foo.s + call foo + +#--- bar.s +.globl bar +bar: + call __real_foo + #--- wrap.s .globl __wrap_bar __wrap_bar: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
Re: [llvm-branch-commits] [clang] 82e537a - [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR
+Tres Popp (FYI) Hi Shilei, The other openmp targets tests are all _cc1 tests. I don't think there's a reason for these to not also be cc1, would you mind updating this? Thanks! -eric On Tue, Jan 19, 2021 at 2:22 PM Shilei Tian via llvm-branch-commits < llvm-branch-commits@lists.llvm.org> wrote: > > Author: Shilei Tian > Date: 2021-01-19T14:18:42-05:00 > New Revision: 82e537a9d28a2c18bd1637e2eac0e0af658ed829 > > URL: > https://github.com/llvm/llvm-project/commit/82e537a9d28a2c18bd1637e2eac0e0af658ed829 > DIFF: > https://github.com/llvm/llvm-project/commit/82e537a9d28a2c18bd1637e2eac0e0af658ed829.diff > > LOG: [Clang][OpenMP] Fixed an issue that clang crashed when compiling > OpenMP program in device only mode without host IR > > D94745 rewrites the `deviceRTLs` using OpenMP and compiles it by directly > calling the device compilation. `clang` crashes because entry in > `OffloadEntriesDeviceGlobalVar` is unintialized. Current design supposes > the > device compilation can only be invoked after host compilation with the > host IR > such that `clang` can initialize `OffloadEntriesDeviceGlobalVar` from host > IR. > This avoids us using device compilation directly, especially when we only > have > code wrapped into `declare target` which are all device code. The same > issue > also exists for `OffloadEntriesInfoManager`. > > In this patch, we simply initialized an entry if it is not in the maps. > Not sure > we need an option to tell the device compiler that it is invoked > standalone. > > Reviewed By: jdoerfert > > Differential Revision: https://reviews.llvm.org/D94871 > > Added: > clang/test/OpenMP/declare_target_device_only_compilation.cpp > > Modified: > clang/lib/CodeGen/CGOpenMPRuntime.cpp > > Removed: > > > > > > diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp > b/clang/lib/CodeGen/CGOpenMPRuntime.cpp > index a3b24039365b..17fa56fb06c8 100644 > --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp > +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp > @@ -2941,16 +2941,12 @@ void CGOpenMPRuntime::OffloadEntriesInfoManagerTy:: >// If we are emitting code for a target, the entry is already > initialized, >// only has to be registered. >if (CGM.getLangOpts().OpenMPIsDevice) { > -if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum)) > { > - unsigned DiagID = CGM.getDiags().getCustomDiagID( > - DiagnosticsEngine::Error, > - "Unable to find target region on line '%0' in the device > code."); > - CGM.getDiags().Report(DiagID) << LineNum; > - return; > -} > +// This could happen if the device compilation is invoked standalone. > +if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum)) > + initializeTargetRegionEntryInfo(DeviceID, FileID, ParentName, > LineNum, > + OffloadingEntriesNum); > auto &Entry = > OffloadEntriesTargetRegion[DeviceID][FileID][ParentName][LineNum]; > -assert(Entry.isValid() && "Entry not initialized!"); > Entry.setAddress(Addr); > Entry.setID(ID); > Entry.setFlags(Flags); > @@ -3017,9 +3013,10 @@ void CGOpenMPRuntime::OffloadEntriesInfoManagerTy:: > OMPTargetGlobalVarEntryKind Flags, > llvm::GlobalValue::LinkageTypes > Linkage) { >if (CGM.getLangOpts().OpenMPIsDevice) { > +// This could happen if the device compilation is invoked standalone. > +if (!hasDeviceGlobalVarEntryInfo(VarName)) > + initializeDeviceGlobalVarEntryInfo(VarName, Flags, > OffloadingEntriesNum); > auto &Entry = OffloadEntriesDeviceGlobalVar[VarName]; > -assert(Entry.isValid() && Entry.getFlags() == Flags && > - "Entry not initialized!"); > assert((!Entry.getAddress() || Entry.getAddress() == Addr) && > "Resetting with the new address."); > if (Entry.getAddress() && hasDeviceGlobalVarEntryInfo(VarName)) { > > diff --git a/clang/test/OpenMP/declare_target_device_only_compilation.cpp > b/clang/test/OpenMP/declare_target_device_only_compilation.cpp > new file mode 100644 > index ..280959540306 > --- /dev/null > +++ b/clang/test/OpenMP/declare_target_device_only_compilation.cpp > @@ -0,0 +1,15 @@ > > +//==/// > +// RUN: %clang -S -target powerpc64le-ibm-linux-gnu -fopenmp > -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s > +// RUN: %clang -S -target i386-pc-linux-gnu -fopenmp > -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s > +// RUN: %clang -S -target x86_64-unknown-linux-gnu -fopenmp > -fopenmp-targets=x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s > +// expected-no-diagnostics > + > +#pragma omp declare target > +#pragma omp begin declare variant match(device={kind(nohost)}) > +int G1; > +#pragma omp e
[llvm-branch-commits] [mlir] b5c542d - [mlir][sparse] add narrower choices for pointers/indices
Author: Aart Bik Date: 2021-01-19T20:20:38-08:00 New Revision: b5c542d64b98b5a74d35dedad41051a0b00d7946 URL: https://github.com/llvm/llvm-project/commit/b5c542d64b98b5a74d35dedad41051a0b00d7946 DIFF: https://github.com/llvm/llvm-project/commit/b5c542d64b98b5a74d35dedad41051a0b00d7946.diff LOG: [mlir][sparse] add narrower choices for pointers/indices Use cases with 16- or even 8-bit pointer/index structures have been identified. Reviewed By: penpornk Differential Revision: https://reviews.llvm.org/D95015 Added: Modified: mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp mlir/test/Dialect/Linalg/sparse_storage.mlir mlir/test/lib/Transforms/TestSparsification.cpp Removed: diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h index 0effa2f45c20..611ab6867372 100644 --- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h @@ -853,13 +853,13 @@ enum class SparseVectorizationStrategy { }; /// Defines a type for "pointer" and "index" storage in the sparse storage -/// scheme, with a choice between the native platform-dependent index width, -/// 64-bit integers, or 32-bit integers. A narrow width obviously reduces +/// scheme, with a choice between the native platform-dependent index width +/// or any of 64-/32-/16-/8-bit integers. A narrow width obviously reduces /// the memory footprint of the sparse storage scheme, but the width should /// suffice to define the total required range (viz. the maximum number of /// stored entries per indirection level for the "pointers" and the maximum /// value of each tensor index over all dimensions for the "indices"). -enum class SparseIntType { kNative, kI64, kI32 }; +enum class SparseIntType { kNative, kI64, kI32, kI16, kI8 }; /// Sparsification options. struct SparsificationOptions { diff --git a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp index 898b15266072..cefcdcbed9ae 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp @@ -512,6 +512,10 @@ static Type genIntType(PatternRewriter &rewriter, linalg::SparseIntType tp) { return rewriter.getIntegerType(64); case linalg::SparseIntType::kI32: return rewriter.getIntegerType(32); + case linalg::SparseIntType::kI16: +return rewriter.getIntegerType(16); + case linalg::SparseIntType::kI8: +return rewriter.getIntegerType(8); } llvm_unreachable("unexpected SparseIntType"); } diff --git a/mlir/test/Dialect/Linalg/sparse_storage.mlir b/mlir/test/Dialect/Linalg/sparse_storage.mlir index 69b8e1903d69..ef5dc0d766e3 100644 --- a/mlir/test/Dialect/Linalg/sparse_storage.mlir +++ b/mlir/test/Dialect/Linalg/sparse_storage.mlir @@ -6,6 +6,10 @@ // RUN: FileCheck %s --check-prefix=CHECK-TYPE2 // RUN: mlir-opt %s -test-sparsification="ptr-type=2 ind-type=2" | \ // RUN: FileCheck %s --check-prefix=CHECK-TYPE3 +// RUN: mlir-opt %s -test-sparsification="ptr-type=3 ind-type=3" | \ +// RUN: FileCheck %s --check-prefix=CHECK-TYPE4 +// RUN: mlir-opt %s -test-sparsification="ptr-type=4 ind-type=4" | \ +// RUN: FileCheck %s --check-prefix=CHECK-TYPE5 #trait_mul_1d = { indexing_maps = [ @@ -86,6 +90,38 @@ // CHECK-TYPE3: store %[[MUL]], %{{.*}}[%[[INDC]]] : memref<32xf64> // CHECK-TYPE3: } +// CHECK-TYPE4-LABEL: func @mul_dd( +// CHECK-TYPE4: %[[C0:.*]] = constant 0 : index +// CHECK-TYPE4: %[[C1:.*]] = constant 1 : index +// CHECK-TYPE4: %[[P0:.*]] = load %{{.*}}[%[[C0]]] : memref +// CHECK-TYPE4: %[[B0:.*]] = index_cast %[[P0]] : i16 to index +// CHECK-TYPE4: %[[P1:.*]] = load %{{.*}}[%[[C1]]] : memref +// CHECK-TYPE4: %[[B1:.*]] = index_cast %[[P1]] : i16 to index +// CHECK-TYPE4: scf.for %[[I:.*]] = %[[B0]] to %[[B1]] step %[[C1]] { +// CHECK-TYPE4: %[[IND0:.*]] = load %{{.*}}[%[[I]]] : memref +// CHECK-TYPE4: %[[INDC:.*]] = index_cast %[[IND0]] : i16 to index +// CHECK-TYPE4: %[[VAL0:.*]] = load %{{.*}}[%[[I]]] : memref +// CHECK-TYPE4: %[[VAL1:.*]] = load %{{.*}}[%[[INDC]]] : memref<32xf64> +// CHECK-TYPE4: %[[MUL:.*]] = mulf %[[VAL0]], %[[VAL1]] : f64 +// CHECK-TYPE4: store %[[MUL]], %{{.*}}[%[[INDC]]] : memref<32xf64> +// CHECK-TYPE4: } + +// CHECK-TYPE5-LABEL: func @mul_dd( +// CHECK-TYPE5: %[[C0:.*]] = constant 0 : index +// CHECK-TYPE5: %[[C1:.*]] = constant 1 : index +// CHECK-TYPE5: %[[P0:.*]] = load %{{.*}}[%[[C0]]] : memref +// CHECK-TYPE5: %[[B0:.*]] = index_cast %[[P0]] : i8 to index +// CHECK-TYPE5: %[[P1:.*]] = load %{{.*}}[%[[C1]]] : memref +// CHECK-TYPE5: %[[B1:.*]] = index_cast %[[P1]] : i8 to index +// CHECK-TYPE5: scf.for %[[I:.*]] = %[[B0]] to %[[B1]] step %[[C1]] { +// CHECK-TYPE5: %[
[llvm-branch-commits] [llvm] b023cde - [llvm] Use llvm::all_of (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:17-08:00 New Revision: b023cdeacce3e7029d8a684bfbcb6f1c88dc1017 URL: https://github.com/llvm/llvm-project/commit/b023cdeacce3e7029d8a684bfbcb6f1c88dc1017 DIFF: https://github.com/llvm/llvm-project/commit/b023cdeacce3e7029d8a684bfbcb6f1c88dc1017.diff LOG: [llvm] Use llvm::all_of (NFC) Added: Modified: llvm/lib/Analysis/IRSimilarityIdentifier.cpp llvm/lib/CodeGen/MachineVerifier.cpp llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/lib/Transforms/Scalar/GuardWidening.cpp llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp Removed: diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp index d8403abc3027..25443a667908 100644 --- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp +++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp @@ -124,15 +124,13 @@ bool IRSimilarity::isClose(const IRInstructionData &A, auto ZippedOperands = zip(GEP->indices(), OtherGEP->indices()); -auto ZIt = ZippedOperands.begin(); - // We increment here since we do not care about the first instruction, // we only care about the following operands since they must be the // exact same to be considered similar. -return std::all_of(++ZIt, ZippedOperands.end(), - [](std::tuple R) { - return std::get<0>(R) == std::get<1>(R); - }); +return all_of(drop_begin(ZippedOperands), + [](std::tuple R) { +return std::get<0>(R) == std::get<1>(R); + }); } // If the instructions are functions, we make sure that the function name is diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index 1cfadef251c5..9045019dc1ee 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -1005,16 +1005,15 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) { } case TargetOpcode::G_PHI: { LLT DstTy = MRI->getType(MI->getOperand(0).getReg()); -if (!DstTy.isValid() || -!std::all_of(MI->operands_begin() + 1, MI->operands_end(), - [this, &DstTy](const MachineOperand &MO) { - if (!MO.isReg()) - return true; - LLT Ty = MRI->getType(MO.getReg()); - if (!Ty.isValid() || (Ty != DstTy)) - return false; - return true; - })) +if (!DstTy.isValid() || !all_of(drop_begin(MI->operands()), +[this, &DstTy](const MachineOperand &MO) { + if (!MO.isReg()) +return true; + LLT Ty = MRI->getType(MO.getReg()); + if (!Ty.isValid() || (Ty != DstTy)) +return false; + return true; +})) report("Generic Instruction G_PHI has operands with incompatible/missing " "types", MI); diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1bee1421cac0..f7c6a77b9a03 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -19452,9 +19452,8 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) { return DAG.getUNDEF(VT); // Optimize concat_vectors where all but the first of the vectors are undef. - if (std::all_of(std::next(N->op_begin()), N->op_end(), [](const SDValue &Op) { -return Op.isUndef(); - })) { + if (all_of(drop_begin(N->ops()), + [](const SDValue &Op) { return Op.isUndef(); })) { SDValue In = N->getOperand(0); assert(In.getValueType().isVector() && "Must concat vectors"); @@ -21441,11 +21440,10 @@ SDValue DAGCombiner::SimplifyVBinOp(SDNode *N) { // Make sure all but the first op are undef or constant. auto ConcatWithConstantOrUndef = [](SDValue Concat) { return Concat.getOpcode() == ISD::CONCAT_VECTORS && - std::all_of(std::next(Concat->op_begin()), Concat->op_end(), - [](const SDValue &Op) { - return Op.isUndef() || - ISD::isBuildVectorOfConstantSDNodes(Op.getNode()); - }); + all_of(drop_begin(Concat->ops()), [](const SDValue &Op) { + return Op.isUndef() || +ISD::isBuildVectorOfConstantSDNodes(Op.getNode()); + }); }; // The following pattern is likely to emerge with vector reduction ops. Moving diff --git a/llvm/
[llvm-branch-commits] [llvm] 978c754 - [llvm] Use llvm::any_of (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:16-08:00 New Revision: 978c754076e37c7b392240dd121b5b6cb8d1bde2 URL: https://github.com/llvm/llvm-project/commit/978c754076e37c7b392240dd121b5b6cb8d1bde2 DIFF: https://github.com/llvm/llvm-project/commit/978c754076e37c7b392240dd121b5b6cb8d1bde2.diff LOG: [llvm] Use llvm::any_of (NFC) Added: Modified: llvm/lib/Support/CommandLine.cpp llvm/tools/llvm-objcopy/ELF/Object.cpp llvm/utils/TableGen/AsmWriterEmitter.cpp Removed: diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c8578f9ce32c..6d89481bf28a 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1204,7 +1204,7 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, }; // Check for recursive response files. -if (std::any_of(FileStack.begin() + 1, FileStack.end(), IsEquivalent)) { +if (any_of(drop_begin(FileStack), IsEquivalent)) { // This file is recursive, so we leave it in the argument stream and // move on. AllExpanded = false; diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index 2f455d7ecc1e..0ff82f951b62 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -2451,8 +2451,8 @@ template Error ELFWriter::finalize() { if (Obj.sections().size() >= SHN_LORESERVE) { SectionTableRef Sections = Obj.sections(); NeedsLargeIndexes = -std::any_of(Sections.begin() + SHN_LORESERVE, Sections.end(), -[](const SectionBase &Sec) { return Sec.HasSymbol; }); +any_of(drop_begin(Sections, SHN_LORESERVE), + [](const SectionBase &Sec) { return Sec.HasSymbol; }); // TODO: handle case where only one section needs the large index table but // only needs it because the large index table hasn't been removed yet. } diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 3e27bd78b376..a09ea775808c 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -218,12 +218,11 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, // Otherwise, scan to see if all of the other instructions in this command // set share the operand. - if (std::any_of(Idxs.begin()+1, Idxs.end(), - [&](unsigned Idx) { -const AsmWriterInst &OtherInst = Instructions[Idx]; -return OtherInst.Operands.size() == Op || - OtherInst.Operands[Op] != FirstInst.Operands[Op]; - })) + if (any_of(drop_begin(Idxs), [&](unsigned Idx) { +const AsmWriterInst &OtherInst = Instructions[Idx]; +return OtherInst.Operands.size() == Op || + OtherInst.Operands[Op] != FirstInst.Operands[Op]; + })) break; // Okay, everything in this command set has the same next operand. Add it ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8857202 - [llvm] Use llvm::find (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:14-08:00 New Revision: 885720248921324d28b983248dcc4056fd994a0f URL: https://github.com/llvm/llvm-project/commit/885720248921324d28b983248dcc4056fd994a0f DIFF: https://github.com/llvm/llvm-project/commit/885720248921324d28b983248dcc4056fd994a0f.diff LOG: [llvm] Use llvm::find (NFC) Added: Modified: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/MCA/Stages/InstructionTables.cpp llvm/lib/Support/DynamicLibrary.cpp llvm/lib/Target/Hexagon/HexagonSubtarget.cpp llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp llvm/lib/Transforms/Scalar/GuardWidening.cpp llvm/lib/Transforms/Vectorize/VPlan.h llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp llvm/utils/TableGen/SubtargetEmitter.cpp Removed: diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index ef83df8bdd96..1bee1421cac0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18957,8 +18957,7 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode *N) { // Have we seen this input vector before? // The vectors are expected to be tiny (usually 1 or 2 elements), so using // a map back from SDValues to numbers isn't worth it. -unsigned Idx = std::distance( -VecIn.begin(), std::find(VecIn.begin(), VecIn.end(), ExtractedFromVec)); +unsigned Idx = std::distance(VecIn.begin(), find(VecIn, ExtractedFromVec)); if (Idx == VecIn.size()) VecIn.push_back(ExtractedFromVec); diff --git a/llvm/lib/MCA/Stages/InstructionTables.cpp b/llvm/lib/MCA/Stages/InstructionTables.cpp index a0cdfb89c553..93e368123066 100644 --- a/llvm/lib/MCA/Stages/InstructionTables.cpp +++ b/llvm/lib/MCA/Stages/InstructionTables.cpp @@ -30,8 +30,7 @@ Error InstructionTables::execute(InstRef &IR) { if (!Resource.second.size()) continue; unsigned Cycles = Resource.second.size(); -unsigned Index = std::distance( -Masks.begin(), std::find(Masks.begin(), Masks.end(), Resource.first)); +unsigned Index = std::distance(Masks.begin(), find(Masks, Resource.first)); const MCProcResourceDesc &ProcResource = *SM.getProcResource(Index); unsigned NumUnits = ProcResource.NumUnits; if (!ProcResource.SubUnitsIdxBegin) { diff --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp index d23716016fb2..bdf74623670b 100644 --- a/llvm/lib/Support/DynamicLibrary.cpp +++ b/llvm/lib/Support/DynamicLibrary.cpp @@ -39,9 +39,7 @@ class DynamicLibrary::HandleSet { HandleSet() : Process(nullptr) {} ~HandleSet(); - HandleList::iterator Find(void *Handle) { -return std::find(Handles.begin(), Handles.end(), Handle); - } + HandleList::iterator Find(void *Handle) { return find(Handles, Handle); } bool Contains(void *Handle) { return Handle == Process || Find(Handle) != Handles.end(); diff --git a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp index fed1abb9549b..87b1c43961d7 100644 --- a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp +++ b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp @@ -527,7 +527,7 @@ void HexagonSubtarget::restoreLatency(SUnit *Src, SUnit *Dst) const { // Update the latency of opposite edge too. T.setSUnit(Src); -auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T); +auto F = find(Dst->Preds, T); assert(F != Dst->Preds.end()); F->setLatency(I.getLatency()); } @@ -544,7 +544,7 @@ void HexagonSubtarget::changeLatency(SUnit *Src, SUnit *Dst, unsigned Lat) // Update the latency of opposite edge too. T.setSUnit(Src); -auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T); +auto F = find(Dst->Preds, T); assert(F != Dst->Preds.end()); F->setLatency(Lat); } diff --git a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp index 90cc81beb89d..5cee00c61fc1 100644 --- a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp +++ b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp @@ -206,9 +206,9 @@ static bool splitMBB(BlockSplitInfo &BSI) { NewMBB->splice(NewMBB->end(), ThisMBB, InsertPoint, ThisMBB->end()); NewMBB->transferSuccessors(ThisMBB); if (!ProbOrigTarget.isUnknown()) { -auto MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigTarget); +auto MBBI = find(NewMBB->successors(), OrigTarget); NewMBB->setSuccProbability(MBBI, ProbOrigTarget); -MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigFallThrough); +MBBI = find(NewMBB->successors(), OrigFallThrough); NewMBB->setSuccProbability(MBBI, ProbOrigFallThrough); } diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp index 1735266f0e58..6ce79bdb7076
[llvm-branch-commits] [llvm] 2e74a27 - [SimplifyCFG] Reapply update_test_checks.py (NFC)
Author: Juneyoung Lee Date: 2021-01-20T12:41:30+09:00 New Revision: 2e74a2775665eea221c6819af44011f7489df856 URL: https://github.com/llvm/llvm-project/commit/2e74a2775665eea221c6819af44011f7489df856 DIFF: https://github.com/llvm/llvm-project/commit/2e74a2775665eea221c6819af44011f7489df856.diff LOG: [SimplifyCFG] Reapply update_test_checks.py (NFC) Added: Modified: llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll Removed: diff --git a/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll b/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll index 078d0aa2f1de..25106d435cc7 100644 --- a/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll +++ b/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll @@ -318,10 +318,10 @@ define void @test8(i64 %x, i64 %y) nounwind { ; CHECK-NEXT:[[LT:%.*]] = icmp slt i64 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT:br i1 [[LT]], label [[A:%.*]], label [[B:%.*]], !prof !7 ; CHECK: a: -; CHECK-NEXT:call void @helper(i32 0) #1 +; CHECK-NEXT:call void @helper(i32 0) [[ATTR1:#.*]] ; CHECK-NEXT:ret void ; CHECK: b: -; CHECK-NEXT:call void @helper(i32 1) #1 +; CHECK-NEXT:call void @helper(i32 1) [[ATTR1]] ; CHECK-NEXT:ret void ; entry: @@ -355,14 +355,14 @@ define i1 @test9(i32 %x, i32 %y) nounwind { ; CHECK-NEXT:i32 92, label [[END]] ; CHECK-NEXT:], !prof !8 ; CHECK: a: -; CHECK-NEXT:call void @helper(i32 0) #1 +; CHECK-NEXT:call void @helper(i32 0) [[ATTR1]] ; CHECK-NEXT:[[RETA:%.*]] = icmp slt i32 [[X]], [[Y:%.*]] ; CHECK-NEXT:ret i1 [[RETA]] ; CHECK: bees: ; CHECK-NEXT:br label [[END]] ; CHECK: end: ; CHECK-NEXT:[[RET:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[BEES]] ], [ true, [[ENTRY]] ], [ true, [[ENTRY]] ] -; CHECK-NEXT:call void @helper(i32 2) #1 +; CHECK-NEXT:call void @helper(i32 2) [[ATTR1]] ; CHECK-NEXT:ret i1 [[RET]] ; entry: @@ -394,10 +394,10 @@ define void @test10(i32 %x) nounwind readnone ssp noredzone { ; CHECK-NEXT:[[SWITCH:%.*]] = icmp ult i32 [[X_OFF]], 3 ; CHECK-NEXT:br i1 [[SWITCH]], label [[LOR_END:%.*]], label [[LOR_RHS:%.*]], !prof !9 ; CHECK: lor.rhs: -; CHECK-NEXT:call void @helper(i32 1) #1 +; CHECK-NEXT:call void @helper(i32 1) [[ATTR1]] ; CHECK-NEXT:ret void ; CHECK: lor.end: -; CHECK-NEXT:call void @helper(i32 0) #1 +; CHECK-NEXT:call void @helper(i32 0) [[ATTR1]] ; CHECK-NEXT:ret void ; entry: @@ -424,10 +424,10 @@ define void @test11(i32 %x) nounwind { ; CHECK-NEXT:[[COND:%.*]] = icmp eq i32 [[I]], 24 ; CHECK-NEXT:br i1 [[COND]], label [[C:%.*]], label [[A:%.*]], !prof !10 ; CHECK: a: -; CHECK-NEXT:call void @helper(i32 0) #1 +; CHECK-NEXT:call void @helper(i32 0) [[ATTR1]] ; CHECK-NEXT:ret void ; CHECK: c: -; CHECK-NEXT:call void @helper(i32 2) #1 +; CHECK-NEXT:call void @helper(i32 2) [[ATTR1]] ; CHECK-NEXT:ret void ; %i = shl i32 %x, 1 @@ -472,7 +472,7 @@ sw.epilog: define void @test13(i32 %x) nounwind { ; CHECK-LABEL: @test13( ; CHECK-NEXT: entry: -; CHECK-NEXT:call void @helper(i32 0) #1 +; CHECK-NEXT:call void @helper(i32 0) [[ATTR1]] ; CHECK-NEXT:ret void ; entry: @@ -541,8 +541,8 @@ define i32 @HoistThenElseCodeToIf(i32 %n) { ; CHECK-LABEL: @HoistThenElseCodeToIf( ; CHECK-NEXT: entry: ; CHECK-NEXT:[[TOBOOL:%.*]] = icmp eq i32 [[N:%.*]], 0 -; CHECK-NEXT:[[DOT:%.*]] = select i1 [[TOBOOL]], i32 1, i32 234, !prof !12 -; CHECK-NEXT:ret i32 [[DOT]] +; CHECK-NEXT:[[RETVAL_0:%.*]] = select i1 [[TOBOOL]], i32 1, i32 234, !prof !12 +; CHECK-NEXT:ret i32 [[RETVAL_0]] ; entry: %tobool = icmp eq i32 %n, 0 diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll index cdc334e474b6..a4f9e1dd29dd 100644 --- a/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll +++ b/llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll @@ -208,7 +208,7 @@ define i1 @test6({ i32, i32 }* %I) { ; CHECK-LABEL: @test6( ; CHECK-NEXT: entry: ; CHECK-NEXT:[[TMP_1_I:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[I:%.*]], i64 0, i32 1 -; CHECK-NEXT:[[TMP_2_I:%.*]] = load i32, i32* [[TMP_1_I]] +; CHECK-NEXT:[[TMP_2_I:%.*]] = load i32, i32* [[TMP_1_I]], align 4 ; CHECK-NEXT:[[TMP_2_I_OFF:%.*]] = add i32 [[TMP_2_I]], -14 ; CHECK-NEXT:[[SWITCH:%.*]] = icmp ult i32 [[TMP_2_I_OFF]], 6 ; CHECK-NEXT:[[SPEC_SELECT:%.*]] = select i1 [[SWITCH]], i1 true, i1 false @@ -253,7 +253,7 @@ define void @test7(i8 zeroext %c, i32 %x) nounwind ssp noredzone { ; CHECK-NEXT:i8 97, label [[IF_THEN]] ; CHECK-NEXT:] ; CHECK: if.then: -; CHECK-NEXT:tail call void @foo1() #2 +; CHEC
[llvm-branch-commits] [llvm] 4dae224 - [RISCV] refactor VPatBinary (NFC)
Author: ShihPo Hung Date: 2021-01-19T19:09:56-08:00 New Revision: 4dae2247fd62f1319de6297fa5088ab1b0175d88 URL: https://github.com/llvm/llvm-project/commit/4dae2247fd62f1319de6297fa5088ab1b0175d88 DIFF: https://github.com/llvm/llvm-project/commit/4dae2247fd62f1319de6297fa5088ab1b0175d88.diff LOG: [RISCV] refactor VPatBinary (NFC) Make it easier to reuse for intrinsic vrgatherei16 which needs to encode both LMUL & EMUL in the instruction name, like PseudoVRGATHEREI16_VV_M1_M1 and PseudoVRGATHEREI16_VV_M1_M2. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D94951 Added: Modified: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td Removed: diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td index 85826b26eedf..4e08ab0d563c 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -1522,32 +1522,28 @@ class VPatUnaryAnyMask : Pat<(result_type (!cast(intrinsic_name) (op1_type op1_reg_class:$rs1), (op2_type op2_kind:$rs2), (XLenVT GPR:$vl))), - (!cast(inst#"_"#kind#"_"#vlmul.MX) + (!cast(inst) (op1_type op1_reg_class:$rs1), ToFPR32.ret, (NoX0 GPR:$vl), sew)>; class VPatBinaryMask : @@ -1557,7 +1553,7 @@ class VPatBinaryMask(inst#"_"#kind#"_"#vlmul.MX#"_MASK") + (!cast(inst#"_MASK") (result_type result_reg_class:$merge), (op1_type op1_reg_class:$rs1), ToFPR32.ret, @@ -1869,21 +1865,19 @@ multiclass VPatNullaryM { multiclass VPatBinary { - def : VPatBinaryNoMask; - def : VPatBinaryMask; + def : VPatBinaryMask; } @@ -1951,9 +1945,9 @@ multiclass VPatConversion vtilist> { foreach vti = vtilist in -defm : VPatBinary; } @@ -1961,46 +1955,47 @@ multiclass VPatBinaryV_VV_INT vtilist> { foreach vti = vtilist in { defvar ivti = GetIntVTypeInfo.Vti; -defm : VPatBinary; } } multiclass VPatBinaryV_VX vtilist> { - foreach vti = vtilist in -defm : VPatBinary; + } } multiclass VPatBinaryV_VX_INT vtilist> { foreach vti = vtilist in -defm : VPatBinary; } multiclass VPatBinaryV_VI vtilist, Operand imm_type> { foreach vti = vtilist in -defm : VPatBinary; } multiclass VPatBinaryM_MM { foreach mti = AllMasks in -def : VPatBinaryNoMask; + mti.SEW, VR, VR>; } multiclass VPatBinaryW_VV; } } @@ -2020,10 +2015,10 @@ multiclass VPatBinaryW_VX; } } @@ -2033,9 +2028,9 @@ multiclass VPatBinaryW_WV; } } @@ -2045,10 +2040,10 @@ multiclass VPatBinaryW_WX; } } @@ -2058,9 +2053,9 @@ multiclass VPatBinaryV_WV; } } @@ -2070,10 +2065,10 @@ multiclass VPatBinaryV_WX; } } @@ -2083,9 +2078,9 @@ multiclass VPatBinaryV_WI; } } @@ -2150,28 +2145,29 @@ multiclass VPatBinaryV_I { multiclass VPatBinaryM_VV vtilist> { foreach vti = vtilist in -defm : VPatBinary; } multiclass VPatBinaryM_VX vtilist> { - foreach vti = vtilist in -defm : VPatBinary; + } } multiclass VPatBinaryM_VI vtilist> { foreach vti = vtilist in -defm : VPatBinary; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 4479c0c - Allow nonnull/align attribute to accept poison
Author: Juneyoung Lee Date: 2021-01-20T11:31:23+09:00 New Revision: 4479c0c2c0be019b9932c6f1380a40e6cb48da25 URL: https://github.com/llvm/llvm-project/commit/4479c0c2c0be019b9932c6f1380a40e6cb48da25 DIFF: https://github.com/llvm/llvm-project/commit/4479c0c2c0be019b9932c6f1380a40e6cb48da25.diff LOG: Allow nonnull/align attribute to accept poison Currently LLVM is relying on ValueTracking's `isKnownNonZero` to attach `nonnull`, which can return true when the value is poison. To make the semantics of `nonnull` consistent with the behavior of `isKnownNonZero`, this makes the semantics of `nonnull` to accept poison, and return poison if the input pointer isn't null. This makes many transformations like below legal: ``` %p = gep inbounds %x, 1 ; % p is non-null pointer or poison call void @f(%p); instcombine converts this to call void @f(nonnull %p) ``` Instead, this semantics makes propagation of `nonnull` to caller illegal. The reason is that, passing poison to `nonnull` does not immediately raise UB anymore, so such program is still well defined, if the callee does not use the argument. Having `noundef` attribute there re-allows this. ``` define void @f(i8* %p) { ; functionattr cannot mark %p nonnull here anymore call void @g(i8* nonnull %p) ; .. because @g never raises UB if it never uses %p. ret void } ``` Another attribute that needs to be updated is `align`. This patch updates the semantics of align to accept poison as well. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D90529 Added: Modified: llvm/docs/LangRef.rst llvm/include/llvm/IR/Argument.h llvm/lib/Analysis/ValueTracking.cpp llvm/lib/IR/Function.cpp llvm/lib/Transforms/IPO/FunctionAttrs.cpp llvm/test/Analysis/ValueTracking/known-nonnull-at.ll llvm/test/Transforms/Attributor/align.ll llvm/test/Transforms/Attributor/nonnull.ll llvm/test/Transforms/FunctionAttrs/nonnull.ll llvm/test/Transforms/InstCombine/call_nonnull_arg.ll llvm/test/Transforms/InstCombine/unused-nonnull.ll Removed: diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 1b6052f58f9d..cd3bb0de4f34 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -1160,10 +1160,12 @@ Currently, only the following parameter attributes are defined: .. _attr_align: ``align `` or ``align()`` -This indicates that the pointer value may be assumed by the optimizer to -have the specified alignment. If the pointer value does not have the -specified alignment, behavior is undefined. ``align 1`` has no effect on -non-byval, non-preallocated arguments. +This indicates that the pointer value has the specified alignment. +If the pointer value does not have the specified alignment, +:ref:`poison value ` is returned or passed instead. The +``align`` attribute should be combined with the ``noundef`` attribute to +ensure a pointer is aligned, or otherwise the behavior is undefined. Note +that ``align 1`` has no effect on non-byval, non-preallocated arguments. Note that this attribute has additional semantics when combined with the ``byval`` or ``preallocated`` attribute, which are documented there. @@ -1225,7 +1227,9 @@ Currently, only the following parameter attributes are defined: This indicates that the parameter or return pointer is not null. This attribute may only be applied to pointer typed parameters. This is not checked or enforced by LLVM; if the parameter or return pointer is null, -the behavior is undefined. +:ref:`poison value ` is returned or passed instead. +The ``nonnull`` attribute should be combined with the ``noundef`` attribute +to ensure a pointer is not null or otherwise the behavior is undefined. ``dereferenceable()`` This indicates that the parameter or return pointer is dereferenceable. This diff --git a/llvm/include/llvm/IR/Argument.h b/llvm/include/llvm/IR/Argument.h index f59a498dc75d..76d780485ea0 100644 --- a/llvm/include/llvm/IR/Argument.h +++ b/llvm/include/llvm/IR/Argument.h @@ -52,7 +52,9 @@ class Argument final : public Value { /// Return true if this argument has the nonnull attribute. Also returns true /// if at least one byte is known to be dereferenceable and the pointer is in /// addrspace(0). - bool hasNonNullAttr() const; + /// If AllowUndefOrPoison is true, respect the semantics of nonnull attribute + /// and return true even if the argument can be undef or poison. + bool hasNonNullAttr(bool AllowUndefOrPoison = true) const; /// If this argument has the dereferenceable attribute, return the number of /// bytes known to be dereferenceable. Otherwise, zero is returned. diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 4f0c7057089b..ef3558ef136e 100644 --- a/llvm/lib/Analysis/ValueTrack
[llvm-branch-commits] [llvm] daeea96 - [llvm-profgen][NFC] Fix the incorrect computation of callsite sample count
Author: wlei Date: 2021-01-19T17:50:48-08:00 New Revision: daeea961a6d93f301e7a22659a2c203846fd58f2 URL: https://github.com/llvm/llvm-project/commit/daeea961a6d93f301e7a22659a2c203846fd58f2 DIFF: https://github.com/llvm/llvm-project/commit/daeea961a6d93f301e7a22659a2c203846fd58f2.diff LOG: [llvm-profgen][NFC] Fix the incorrect computation of callsite sample count Differential Revision: https://reviews.llvm.org/D95009 Added: Modified: llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test llvm/tools/llvm-profgen/ProfileGenerator.cpp Removed: diff --git a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test index 385009d2d539..9beecb271fc0 100644 --- a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test +++ b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test @@ -7,7 +7,7 @@ ; CHECK: 2: 2 ; CHECK: 4: 1 ; CHECK: 5: 3 -; CHECK:[main:1 @ foo]:9:0 +; CHECK:[main:1 @ foo]:6:0 ; CHECK: 2: 3 ; CHECK: 3: 3 bar:3 diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp index 7c5c5e3d5fa9..265beccb84a8 100644 --- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp +++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp @@ -239,11 +239,9 @@ void CSProfileGenerator::populateFunctionBoundarySamples( // Record called target sample and its count const FrameLocation &LeafLoc = Binary->getInlineLeafFrameLoc(SourceOffset); - FunctionProfile.addCalledTargetSamples(LeafLoc.second.LineOffset, LeafLoc.second.Discriminator, CalleeName, Count); -FunctionProfile.addTotalSamples(Count); // Record head sample for called target(callee) // TODO: Cleanup ' @ ' @@ -311,8 +309,10 @@ void CSProfileGenerator::populateInferredFunctionSamples() { CallerLeafFrameLoc.second.LineOffset, CallerLeafFrameLoc.second.Discriminator, CalleeProfile.getName(), EstimatedCallCount); -updateBodySamplesforFunctionProfile(CallerProfile, CallerLeafFrameLoc, -EstimatedCallCount); +CallerProfile.addBodySamples(CallerLeafFrameLoc.second.LineOffset, + CallerLeafFrameLoc.second.Discriminator, + EstimatedCallCount); +CallerProfile.addTotalSamples(EstimatedCallCount); } } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 2331062 - [llvm-link] Improve link time for bitcode archives [NFC]
Author: Sergey Dmitriev Date: 2021-01-19T16:41:28-08:00 New Revision: 233106269db6af64f9eff7db0bdf119593f822b1 URL: https://github.com/llvm/llvm-project/commit/233106269db6af64f9eff7db0bdf119593f822b1 DIFF: https://github.com/llvm/llvm-project/commit/233106269db6af64f9eff7db0bdf119593f822b1.diff LOG: [llvm-link] Improve link time for bitcode archives [NFC] Linking large bitcode archives currently takes a lot of time with llvm-link, this patch adds couple improvements which reduce link time for archives - Use one Linker instance for archive instead of recreating it for each member - Lazy load archive members Reviewed By: tra, jdoerfert Differential Revision: https://reviews.llvm.org/D94643 Added: Modified: llvm/tools/llvm-link/llvm-link.cpp Removed: diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 158b168107f1..eed49c438335 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -153,6 +153,7 @@ static std::unique_ptr loadArFile(const char *Argv0, Error Err = Error::success(); object::Archive Archive(*Buffer, Err); ExitOnErr(std::move(Err)); + Linker L(*Result); for (const object::Archive::Child &C : Archive.children(Err)) { Expected Ename = C.getName(); if (Error E = Ename.takeError()) { @@ -186,7 +187,12 @@ static std::unique_ptr loadArFile(const char *Argv0, return nullptr; } -std::unique_ptr M = parseIR(MemBuf.get(), ParseErr, Context); +std::unique_ptr M; +if (DisableLazyLoad) + M = parseIR(MemBuf.get(), ParseErr, Context); +else + M = getLazyIRModule(MemoryBuffer::getMemBuffer(MemBuf.get(), false), + ParseErr, Context); if (!M.get()) { errs() << Argv0 << ": "; @@ -197,7 +203,7 @@ static std::unique_ptr loadArFile(const char *Argv0, } if (Verbose) errs() << "Linking member '" << ChildName << "' of archive library.\n"; -if (Linker::linkModules(*Result, std::move(M))) +if (L.linkInModule(std::move(M))) return nullptr; } // end for each child ExitOnErr(std::move(Err)); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] b62c7e0 - [mlir][python] Swap shape and element_type order for MemRefType.
Author: Stella Laurenzo Date: 2021-01-19T16:03:19-08:00 New Revision: b62c7e047420026dcfe84ad66969f501698acbee URL: https://github.com/llvm/llvm-project/commit/b62c7e047420026dcfe84ad66969f501698acbee DIFF: https://github.com/llvm/llvm-project/commit/b62c7e047420026dcfe84ad66969f501698acbee.diff LOG: [mlir][python] Swap shape and element_type order for MemRefType. * Matches how all of the other shaped types are declared. * No super principled reason fro this ordering beyond that it makes the one that was different be like the rest. * Also matches ordering of things like ndarray, et al. Reviewed By: ftynse, nicolasvasilache Differential Revision: https://reviews.llvm.org/D94812 Added: Modified: mlir/examples/python/linalg_matmul.py mlir/lib/Bindings/Python/IRModules.cpp mlir/test/Bindings/Python/ir_types.py Removed: diff --git a/mlir/examples/python/linalg_matmul.py b/mlir/examples/python/linalg_matmul.py index e9be189bfaaf..0bd3c12a0378 100644 --- a/mlir/examples/python/linalg_matmul.py +++ b/mlir/examples/python/linalg_matmul.py @@ -31,9 +31,9 @@ def FuncOp(name: str, func_type: Type) -> Tuple[Operation, Block]: def build_matmul_buffers_func(func_name, m, k, n, dtype): - lhs_type = MemRefType.get(dtype, [m, k]) - rhs_type = MemRefType.get(dtype, [k, n]) - result_type = MemRefType.get(dtype, [m, n]) + lhs_type = MemRefType.get([m, k], dtype) + rhs_type = MemRefType.get([k, n], dtype) + result_type = MemRefType.get([m, n], dtype) # TODO: There should be a one-liner for this. func_type = FunctionType.get([lhs_type, rhs_type, result_type], []) _, entry = FuncOp(func_name, func_type) @@ -49,8 +49,6 @@ def build_matmul_buffers_func(func_name, m, k, n, dtype): def build_matmul_tensors_func(func_name, m, k, n, dtype): - # TODO: MemRefType and TensorTypes should not have inverted dtype/shapes - # from each other. lhs_type = RankedTensorType.get([m, k], dtype) rhs_type = RankedTensorType.get([k, n], dtype) result_type = RankedTensorType.get([m, n], dtype) diff --git a/mlir/lib/Bindings/Python/IRModules.cpp b/mlir/lib/Bindings/Python/IRModules.cpp index 63bdd0c7a184..3c9f79e2a17a 100644 --- a/mlir/lib/Bindings/Python/IRModules.cpp +++ b/mlir/lib/Bindings/Python/IRModules.cpp @@ -2832,7 +2832,7 @@ class PyMemRefType : public PyConcreteType { static void bindDerived(ClassTy &c) { c.def_static( "get", - [](PyType &elementType, std::vector shape, + [](std::vector shape, PyType &elementType, std::vector layout, unsigned memorySpace, DefaultingPyLocation loc) { SmallVector maps; @@ -2856,7 +2856,7 @@ class PyMemRefType : public PyConcreteType { } return PyMemRefType(elementType.getContext(), t); }, - py::arg("element_type"), py::arg("shape"), + py::arg("shape"), py::arg("element_type"), py::arg("layout") = py::list(), py::arg("memory_space") = 0, py::arg("loc") = py::none(), "Create a memref type") .def_property_readonly("layout", &PyMemRefType::getLayout, diff --git a/mlir/test/Bindings/Python/ir_types.py b/mlir/test/Bindings/Python/ir_types.py index 64b684ee99e9..7402c644a1c1 100644 --- a/mlir/test/Bindings/Python/ir_types.py +++ b/mlir/test/Bindings/Python/ir_types.py @@ -326,7 +326,7 @@ def testMemRefType(): f32 = F32Type.get() shape = [2, 3] loc = Location.unknown() -memref = MemRefType.get(f32, shape, memory_space=2) +memref = MemRefType.get(shape, f32, memory_space=2) # CHECK: memref type: memref<2x3xf32, 2> print("memref type:", memref) # CHECK: number of affine layout maps: 0 @@ -335,7 +335,7 @@ def testMemRefType(): print("memory space:", memref.memory_space) layout = AffineMap.get_permutation([1, 0]) -memref_layout = MemRefType.get(f32, shape, [layout]) +memref_layout = MemRefType.get(shape, f32, [layout]) # CHECK: memref type: memref<2x3xf32, affine_map<(d0, d1) -> (d1, d0)>> print("memref type:", memref_layout) assert len(memref_layout.layout) == 1 @@ -346,7 +346,7 @@ def testMemRefType(): none = NoneType.get() try: - memref_invalid = MemRefType.get(none, shape) + memref_invalid = MemRefType.get(shape, none) except ValueError as e: # CHECK: invalid 'Type(none)' and expected floating point, integer, vector # CHECK: or complex type. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 7f36df0 - [gn build] fix libcxx gn file with libcxx_abi_namespace set
Author: Nico Weber Date: 2021-01-19T19:02:40-05:00 New Revision: 7f36df0fb19c08879822cf5b7d4bba300fc8c058 URL: https://github.com/llvm/llvm-project/commit/7f36df0fb19c08879822cf5b7d4bba300fc8c058 DIFF: https://github.com/llvm/llvm-project/commit/7f36df0fb19c08879822cf5b7d4bba300fc8c058.diff LOG: [gn build] fix libcxx gn file with libcxx_abi_namespace set Added: Modified: llvm/utils/gn/secondary/libcxx/include/BUILD.gn Removed: diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn index faaaf049b063..644f0a767558 100644 --- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn +++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn @@ -25,7 +25,6 @@ write_cmake_config("write_config") { "_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS=1", "_LIBCPP_NO_VCRUNTIME=", "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=", -"_LIBCPP_ABI_NAMESPACE=", "_LIBCPP_HAS_PARALLEL_ALGORITHMS=", "_LIBCPP_HAS_NO_RANDOM_DEVICE=", "_LIBCPP_HAS_NO_LOCALIZATION=", @@ -38,6 +37,8 @@ write_cmake_config("write_config") { } if (libcxx_abi_namespace != "") { values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ] + } else { +values += [ "_LIBCPP_ABI_NAMESPACE=" ] } if (libcxx_abi_unstable) { values += [ "_LIBCPP_ABI_UNSTABLE=1" ] ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] be59bac - [gn build] (manually) port 933518fff82c
Author: Nico Weber Date: 2021-01-19T18:51:39-05:00 New Revision: be59bac184e3a3ccdd3c7f41f31e48ffe77f443d URL: https://github.com/llvm/llvm-project/commit/be59bac184e3a3ccdd3c7f41f31e48ffe77f443d DIFF: https://github.com/llvm/llvm-project/commit/be59bac184e3a3ccdd3c7f41f31e48ffe77f443d.diff LOG: [gn build] (manually) port 933518fff82c Added: Modified: llvm/utils/gn/secondary/libcxx/include/BUILD.gn Removed: diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn index 4d7cdbefb2e6..faaaf049b063 100644 --- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn +++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn @@ -9,6 +9,7 @@ write_cmake_config("write_config") { "_LIBCPP_ABI_FORCE_ITANIUM=", "_LIBCPP_ABI_FORCE_MICROSOFT=", "_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=", +"_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY=", "_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE=", "_LIBCPP_HAS_NO_STDIN=", "_LIBCPP_HAS_NO_STDOUT=", ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 68a1f09 - [xray] Honor xray-never function-instrument attribute
Author: Ian Levesque Date: 2021-01-19T18:47:09-05:00 New Revision: 68a1f09107a4b0c32fe84063ea1c5a902c8817a9 URL: https://github.com/llvm/llvm-project/commit/68a1f09107a4b0c32fe84063ea1c5a902c8817a9 DIFF: https://github.com/llvm/llvm-project/commit/68a1f09107a4b0c32fe84063ea1c5a902c8817a9.diff LOG: [xray] Honor xray-never function-instrument attribute function-instrument=xray-never wasn't actually honored before. We were getting lucky that it worked because CodeGenFunction would omit the other xray attributes when a function was annotated with xray_never_instrument. This patch adds proper support. Differential Revision: https://reviews.llvm.org/D89441 Added: Modified: llvm/lib/CodeGen/XRayInstrumentation.cpp llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll Removed: diff --git a/llvm/lib/CodeGen/XRayInstrumentation.cpp b/llvm/lib/CodeGen/XRayInstrumentation.cpp index d60db382ba59..11d1b309aa64 100644 --- a/llvm/lib/CodeGen/XRayInstrumentation.cpp +++ b/llvm/lib/CodeGen/XRayInstrumentation.cpp @@ -147,6 +147,10 @@ bool XRayInstrumentation::runOnMachineFunction(MachineFunction &MF) { auto InstrAttr = F.getFnAttribute("function-instrument"); bool AlwaysInstrument = InstrAttr.isStringAttribute() && InstrAttr.getValueAsString() == "xray-always"; + bool NeverInstrument = InstrAttr.isStringAttribute() && + InstrAttr.getValueAsString() == "xray-never"; + if (NeverInstrument && !AlwaysInstrument) +return false; auto ThresholdAttr = F.getFnAttribute("xray-instruction-threshold"); auto IgnoreLoopsAttr = F.getFnAttribute("xray-ignore-loops"); unsigned int XRayThreshold = 0; diff --git a/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll b/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll index 651130414bef..b14463ed32a8 100644 --- a/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll +++ b/llvm/test/CodeGen/AArch64/xray-attribute-instrumentation.ll @@ -1,6 +1,7 @@ ; RUN: llc -filetype=asm -o - -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" { +; CHECK-LABEL: foo: ; CHECK-LABEL: Lxray_sled_0: ; CHECK-NEXT: b #32 ; CHECK-NEXT: nop @@ -24,8 +25,80 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" ; CHECK-LABEL: Ltmp1: ; CHECK-NEXT: ret } + ; CHECK-LABEL: xray_instr_map ; CHECK-LABEL: Lxray_sleds_start0 ; CHECK: .xword .Lxray_sled_0 ; CHECK: .xword .Lxray_sled_1 ; CHECK-LABEL: Lxray_sleds_end0 + +define i32 @bar() nounwind noinline uwtable "function-instrument"="xray-never" "function-instrument"="xray-always" { +; CHECK-LABEL: bar: +; CHECK-LABEL: Lxray_sled_2: +; CHECK-NEXT: b #32 +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-LABEL: Ltmp4: + ret i32 0 +; CHECK-LABEL: Lxray_sled_3: +; CHECK-NEXT: b #32 +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-LABEL: Ltmp5: +; CHECK-NEXT: ret +} + +; CHECK-LABEL: xray_instr_map +; CHECK-LABEL: Lxray_sleds_start1 +; CHECK: .xword .Lxray_sled_2 +; CHECK: .xword .Lxray_sled_3 +; CHECK-LABEL: Lxray_sleds_end1 + +define i32 @instrumented() nounwind noinline uwtable "xray-instruction-threshold"="1" { +; CHECK-LABEL: instrumented: +; CHECK-LABEL: Lxray_sled_4: +; CHECK-NEXT: b #32 +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-LABEL: Ltmp8: + ret i32 0 +; CHECK-LABEL: Lxray_sled_5: +; CHECK-NEXT: b #32 +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-NEXT: nop +; CHECK-LABEL: Ltmp9: +; CHECK-NEXT: ret +} + +; CHECK-LABEL: xray_instr_map +; CHECK-LABEL: Lxray_sleds_start2 +; CHECK: .xword .Lxray_sled_4 +; CHECK: .xword .Lxray_sled_5 +; CHECK-LABEL: Lxray_sleds_end2 + +define i32 @not_instrumented() nounwind noinline uwtable "xray-instruction-threshold"="1" "function-instrument"="xray-never" { +; CHECK-LABEL: not_instrumented +; CHECK-NOT: .Lxray_sled_6 + ret i32 0 +; CHECK: ret +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3729ee8 - Fix Wmissing-field-initializers warnings.
Author: Wei Mi Date: 2021-01-19T15:26:52-08:00 New Revision: 3729ee893948be7e3ba138b2a04c4cdfa6257cdf URL: https://github.com/llvm/llvm-project/commit/3729ee893948be7e3ba138b2a04c4cdfa6257cdf DIFF: https://github.com/llvm/llvm-project/commit/3729ee893948be7e3ba138b2a04c4cdfa6257cdf.diff LOG: Fix Wmissing-field-initializers warnings. Added: Modified: llvm/include/llvm/ProfileData/SampleProfWriter.h Removed: diff --git a/llvm/include/llvm/ProfileData/SampleProfWriter.h b/llvm/include/llvm/ProfileData/SampleProfWriter.h index e72963ad5c74..419ebd6eb7ae 100644 --- a/llvm/include/llvm/ProfileData/SampleProfWriter.h +++ b/llvm/include/llvm/ProfileData/SampleProfWriter.h @@ -164,25 +164,25 @@ const std::array, NumOfLayout> // reader need to get the offset of each function profile first. // // DefaultLayout -SmallVector({{SecProfSummary}, - {SecNameTable}, - {SecFuncOffsetTable}, - {SecLBRProfile}, - {SecProfileSymbolList}, - {SecFuncMetadata}}), +SmallVector({{SecProfSummary, 0, 0, 0, 0}, + {SecNameTable, 0, 0, 0, 0}, + {SecFuncOffsetTable, 0, 0, 0, 0}, + {SecLBRProfile, 0, 0, 0, 0}, + {SecProfileSymbolList, 0, 0, 0, 0}, + {SecFuncMetadata, 0, 0, 0, 0}}), // CtxSplitLayout -SmallVector({{SecProfSummary}, - {SecNameTable}, +SmallVector({{SecProfSummary, 0, 0, 0, 0}, + {SecNameTable, 0, 0, 0, 0}, // profile with context // for next two sections - {SecFuncOffsetTable}, - {SecLBRProfile}, + {SecFuncOffsetTable, 0, 0, 0, 0}, + {SecLBRProfile, 0, 0, 0, 0}, // profile without context // for next two sections - {SecFuncOffsetTable}, - {SecLBRProfile}, - {SecProfileSymbolList}, - {SecFuncMetadata}}), + {SecFuncOffsetTable, 0, 0, 0, 0}, + {SecLBRProfile, 0, 0, 0, 0}, + {SecProfileSymbolList, 0, 0, 0, 0}, + {SecFuncMetadata, 0, 0, 0, 0}}), }; class SampleProfileWriterExtBinaryBase : public SampleProfileWriterBinary { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 21b1ad0 - [SampleFDO] Add the support to split the function profiles with context into
Author: Wei Mi Date: 2021-01-19T15:16:19-08:00 New Revision: 21b1ad0340a7ba69c605ea1c218adb567b5190ae URL: https://github.com/llvm/llvm-project/commit/21b1ad0340a7ba69c605ea1c218adb567b5190ae DIFF: https://github.com/llvm/llvm-project/commit/21b1ad0340a7ba69c605ea1c218adb567b5190ae.diff LOG: [SampleFDO] Add the support to split the function profiles with context into separate sections. For ThinLTO, all the function profiles without context has been annotated to outline functions if possible in prelink phase. In postlink phase, profile annotation in postlink phase is only meaningful for function profile with context. If the profile is large, it is better to split the profile into two parts, one with context and one without, so the profile reading in postlink phase only has to read the part with context. To have the profile splitting, we extend the ExtBinary format to support different section arrangement. It will be flexible to add other section layout in the future without the need to create new class inheriting from ExtBinary class. Differential Revision: https://reviews.llvm.org/D94435 Added: llvm/test/Transforms/SampleProfile/Inputs/ctxsplit.extbinary.afdo llvm/test/Transforms/SampleProfile/ctxsplit.ll Modified: llvm/include/llvm/ProfileData/SampleProf.h llvm/include/llvm/ProfileData/SampleProfReader.h llvm/include/llvm/ProfileData/SampleProfWriter.h llvm/lib/ProfileData/SampleProfReader.cpp llvm/lib/ProfileData/SampleProfWriter.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp Removed: diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index c423466fe75b..c45ace9e68c1 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -164,7 +164,9 @@ struct SecHdrTableEntry { // will be saved in the higher 32 bits. enum class SecCommonFlags : uint32_t { SecFlagInValid = 0, - SecFlagCompress = (1 << 0) + SecFlagCompress = (1 << 0), + // Indicate the section contains only profile without context. + SecFlagFlat = (1 << 1) }; // Section specific flags are defined here. diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h index 92fe825beefc..3f52a2f6163b 100644 --- a/llvm/include/llvm/ProfileData/SampleProfReader.h +++ b/llvm/include/llvm/ProfileData/SampleProfReader.h @@ -451,6 +451,10 @@ class SampleProfileReader { /// Return whether names in the profile are all MD5 numbers. virtual bool useMD5() { return false; } + /// Don't read profile without context if the flag is set. This is only meaningful + /// for ExtBinary format. + virtual void setSkipFlatProf(bool Skip) {} + SampleProfileReaderItaniumRemapper *getRemapper() { return Remapper.get(); } protected: @@ -666,6 +670,10 @@ class SampleProfileReaderExtBinaryBase : public SampleProfileReaderBinary { /// the lifetime of MD5StringBuf is not shorter than that of NameTable. std::unique_ptr> MD5StringBuf; + /// If SkipFlatProf is true, skip the sections with + /// SecFlagFlat flag. + bool SkipFlatProf = false; + public: SampleProfileReaderExtBinaryBase(std::unique_ptr B, LLVMContext &C, SampleProfileFormat Format) @@ -689,6 +697,8 @@ class SampleProfileReaderExtBinaryBase : public SampleProfileReaderBinary { virtual std::unique_ptr getProfileSymbolList() override { return std::move(ProfSymList); }; + + virtual void setSkipFlatProf(bool Skip) override { SkipFlatProf = Skip; } }; class SampleProfileReaderExtBinary : public SampleProfileReaderExtBinaryBase { diff --git a/llvm/include/llvm/ProfileData/SampleProfWriter.h b/llvm/include/llvm/ProfileData/SampleProfWriter.h index fc568f06ffc8..e72963ad5c74 100644 --- a/llvm/include/llvm/ProfileData/SampleProfWriter.h +++ b/llvm/include/llvm/ProfileData/SampleProfWriter.h @@ -15,6 +15,7 @@ #include "llvm/ADT/MapVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSet.h" #include "llvm/IR/ProfileSummary.h" #include "llvm/ProfileData/SampleProf.h" #include "llvm/Support/ErrorOr.h" @@ -28,6 +29,15 @@ namespace llvm { namespace sampleprof { +enum SectionLayout { + DefaultLayout, + // The layout splits profile with context information from profile without + // context information. When Thinlto is enabled, ThinLTO postlink phase only + // has to load profile with context information and can skip the other part. + CtxSplitLayout, + NumOfLayout, +}; + /// Sample-based profile writer. Base class. class SampleProfileWriter { public: @@ -60,6 +70,7 @@ class SampleProfileWriter { virtual void setToCompressAllSections() {} virtual void setUseMD5() {} virtual void setPartialProfile() {} + virtual void resetSecLayout(SectionLayout SL) {} protected: SampleProfileWriter(
[llvm-branch-commits] [mlir] 1bf2b16 - Implement constant folding for DivFOp
Author: Jackson Fellows Date: 2021-01-19T23:08:06Z New Revision: 1bf2b1665b43e1a5090177486c8fa6374a4596a2 URL: https://github.com/llvm/llvm-project/commit/1bf2b1665b43e1a5090177486c8fa6374a4596a2 DIFF: https://github.com/llvm/llvm-project/commit/1bf2b1665b43e1a5090177486c8fa6374a4596a2.diff LOG: Implement constant folding for DivFOp Add a constant folder for DivFOp. Analogous to existing folders for AddFOp, SubFOp, and MulFOp. Matches the behavior of existing LLVM constant folding (https://github.com/llvm/llvm-project/blob/999f5da6b3088fa4c0bb9d05b358d015ca74c71f/llvm/lib/IR/ConstantFold.cpp#L1432). Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D94939 Added: Modified: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td mlir/lib/Dialect/StandardOps/IR/Ops.cpp Removed: diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td index 8e3f1f1a7a85..8db6129dbb88 100644 --- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td +++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td @@ -1589,6 +1589,7 @@ def DimOp : Std_Op<"dim", [NoSideEffect]> { def DivFOp : FloatArithmeticOp<"divf"> { let summary = "floating point division operation"; + let hasFolder = 1; } //===--===// diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp index e1be47f54798..1718ab14d5d1 100644 --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -1483,6 +1483,15 @@ void DimOp::getCanonicalizationPatterns(OwningRewritePatternList &results, DimOfCastOp>(context); } +// --- +// DivFOp +// --- + +OpFoldResult DivFOp::fold(ArrayRef operands) { + return constFoldBinaryOp( + operands, [](APFloat a, APFloat b) { return a / b; }); +} + // --- // DmaStartOp // --- ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 96ef4f3 - Revert "[WebAssembly] call_indirect issues table number relocs"
Author: Sam Clegg Date: 2021-01-19T15:06:07-08:00 New Revision: 96ef4f307df27f4e0946eb344bac2703017ad073 URL: https://github.com/llvm/llvm-project/commit/96ef4f307df27f4e0946eb344bac2703017ad073 DIFF: https://github.com/llvm/llvm-project/commit/96ef4f307df27f4e0946eb344bac2703017ad073.diff LOG: Revert "[WebAssembly] call_indirect issues table number relocs" This reverts commit 418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1. This change broke emscripten tests, I believe because it started generating 5-byte a wide table index in the call_indirect instruction. Neither v8 nor wabt seem to be able to handle that. The spec currently says that this is single 0x0 byte and: "In future versions of WebAssembly, the zero byte occurring in the encoding of the call_indirectcall_indirect instruction may be used to index additional tables." So we need to revisit this change. For backwards compat I guess we need to guarantee that __indirect_function_table is always at address zero. We could also consider making this a single-byte relocation with and assert if have more than 127 tables (for now). Differential Revision: https://reviews.llvm.org/D95005 Added: Modified: lld/test/wasm/call-indirect.ll lld/test/wasm/compress-relocs.ll lld/test/wasm/shared.ll llvm/lib/MC/WasmObjectWriter.cpp llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp llvm/test/CodeGen/WebAssembly/function-pointer64.ll llvm/test/CodeGen/WebAssembly/multivalue.ll llvm/test/MC/WebAssembly/basic-assembly.s llvm/test/MC/WebAssembly/reloc-code.ll llvm/test/MC/WebAssembly/tail-call-encodings.s llvm/test/MC/WebAssembly/type-index.s llvm/test/MC/WebAssembly/weak-alias.s Removed: llvm/test/MC/WebAssembly/call-indirect-relocs.s diff --git a/lld/test/wasm/call-indirect.ll b/lld/test/wasm/call-indirect.ll index 08b4336c481d..f6d3df4914bf 100644 --- a/lld/test/wasm/call-indirect.ll +++ b/lld/test/wasm/call-indirect.ll @@ -122,16 +122,16 @@ define void @call_ptr(i64 (i64)* %arg) { ; CHECK-NEXT: Body:42010B ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Locals: -; CHECK-NEXT: Body: 41002802808880800011808080800080808080001A41002802848880800011818080800080808080001A0B +; CHECK-NEXT: Body: 41002802808880800011808080801A41002802848880800011818080801A0B ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Locals: ; CHECK-NEXT: Body:41020B ; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: Locals: -; CHECK-NEXT: Body: 4100280280800011818080800080808080001A0B +; CHECK-NEXT: Body:4100280280800011818080801A0B ; CHECK-NEXT: - Index: 4 ; CHECK-NEXT: Locals: -; CHECK-NEXT: Body:4201200011828080800080808080001A0B +; CHECK-NEXT: Body:4201200011828080801A0B ; CHECK-NEXT: - Type:DATA ; CHECK-NEXT: Segments: ; CHECK-NEXT: - SectionOffset:7 diff --git a/lld/test/wasm/compress-relocs.ll b/lld/test/wasm/compress-relocs.ll index 9285b080a3b5..4d4ac4b705ee 100644 --- a/lld/test/wasm/compress-relocs.ll +++ b/lld/test/wasm/compress-relocs.ll @@ -22,5 +22,5 @@ entry: ; ERROR: wasm-ld: error: --compress-relocations is incompatible with output debug information. Please pass --strip-debug or --strip-all -; CHECK:Body: 41002802808880800011808080800080808080001A41002802848880800011818080800080808080001A0B +; CHECK:Body: 41002802808880800011808080801A41002802848880800011818080801A0B ; COMPRESS: Body:410028028008111A4100280284081101001A0B diff --git a/lld/test/wasm/shared.ll b/lld/test/wasm/shared.ll index aca517ea7443..61337fcc6a3a 100644 --- a/lld/test/wasm/shared.ll +++ b/lld/test/wasm/shared.ll @@ -84,6 +84,10 @@ declare void @func_external() ; CHECK-NEXT: GlobalType: I32 ; CHECK-NEXT: GlobalMutable: false ; CHECK-NEXT: - Module: env +; CHECK-NEXT: Field: func_external +; CHECK-NEXT: Kind:FUNCTION +; CHECK-NEXT: SigIndex:1 +; CHECK-NEXT: - Module: env ; CHECK-NEXT: Field: __indirect_function_table ; CHECK-NEXT: Kind:TABLE ; CHECK-NEXT: Table: @@ -91,10 +95,6 @@ declare void @func_external() ; CHECK-NEXT: ElemType:FUNCREF ; CHECK-NEXT:
[llvm-branch-commits] [clang] 0cd0eb6 - Add API to retrieve a clade kind from ASTNodeKind
Author: Stephen Kelly Date: 2021-01-19T22:51:30Z New Revision: 0cd0eb6e0a8133ec86d884c1bbc9c3cbd1769c0b URL: https://github.com/llvm/llvm-project/commit/0cd0eb6e0a8133ec86d884c1bbc9c3cbd1769c0b DIFF: https://github.com/llvm/llvm-project/commit/0cd0eb6e0a8133ec86d884c1bbc9c3cbd1769c0b.diff LOG: Add API to retrieve a clade kind from ASTNodeKind Differential Revision: https://reviews.llvm.org/D94877 Added: Modified: clang/include/clang/AST/ASTTypeTraits.h clang/lib/AST/ASTTypeTraits.cpp clang/unittests/AST/ASTTypeTraitsTest.cpp Removed: diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h index a91f6b0c1a69..57195a9d6066 100644 --- a/clang/include/clang/AST/ASTTypeTraits.h +++ b/clang/include/clang/AST/ASTTypeTraits.h @@ -100,6 +100,8 @@ class ASTNodeKind { static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1, ASTNodeKind Kind2); + ASTNodeKind getCladeKind() const; + /// Hooks for using ASTNodeKind as a key in a DenseMap. struct DenseMapInfo { // ASTNodeKind() is a good empty key because it is represented as a 0. diff --git a/clang/lib/AST/ASTTypeTraits.cpp b/clang/lib/AST/ASTTypeTraits.cpp index 49335ff37c41..b040f9e4cc40 100644 --- a/clang/lib/AST/ASTTypeTraits.cpp +++ b/clang/lib/AST/ASTTypeTraits.cpp @@ -63,6 +63,17 @@ bool ASTNodeKind::isBaseOf(NodeKindId Base, NodeKindId Derived, return Derived == Base; } +ASTNodeKind ASTNodeKind::getCladeKind() const { + NodeKindId LastId = KindId; + while (LastId) { +NodeKindId ParentId = AllKindInfo[LastId].ParentId; +if (ParentId == NKI_None) + return LastId; +LastId = ParentId; + } + return NKI_None; +} + StringRef ASTNodeKind::asStringRef() const { return AllKindInfo[KindId].Name; } ASTNodeKind ASTNodeKind::getMostDerivedType(ASTNodeKind Kind1, diff --git a/clang/unittests/AST/ASTTypeTraitsTest.cpp b/clang/unittests/AST/ASTTypeTraitsTest.cpp index 998488f1f1f9..18e8b8431b4c 100644 --- a/clang/unittests/AST/ASTTypeTraitsTest.cpp +++ b/clang/unittests/AST/ASTTypeTraitsTest.cpp @@ -39,6 +39,18 @@ TEST(ASTNodeKind, Bases) { EXPECT_TRUE(DNT().isSame(DNT())); } +TEST(DynTypedNode, Clades) { + EXPECT_TRUE(DNT().getCladeKind().isSame(DNT())); + EXPECT_TRUE(DNT().getCladeKind().isSame(DNT())); + + EXPECT_TRUE(DNT().getCladeKind().isSame(DNT())); + EXPECT_TRUE(DNT().getCladeKind().isSame(DNT())); + + EXPECT_FALSE(DNT().getCladeKind().isSame(DNT())); + + EXPECT_TRUE(ASTNodeKind().getCladeKind().isNone()); +} + TEST(ASTNodeKind, BaseDistances) { unsigned Distance = 1; EXPECT_TRUE(DNT().isBaseOf(DNT(), &Distance)); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 22eb1cf - Remove unused functions.
Author: Eric Christopher Date: 2021-01-19T14:44:34-08:00 New Revision: 22eb1cf89f38b33aaf082326ba4dcfee4f98913d URL: https://github.com/llvm/llvm-project/commit/22eb1cf89f38b33aaf082326ba4dcfee4f98913d DIFF: https://github.com/llvm/llvm-project/commit/22eb1cf89f38b33aaf082326ba4dcfee4f98913d.diff LOG: Remove unused functions. Added: Modified: mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp Removed: diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp index bacf2d51..006c68bb408a 100644 --- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp @@ -215,13 +215,6 @@ void VectorizerTestPass::testComposeMaps(llvm::raw_ostream &outs) { simplifyAffineMap(res).print(outs << "\nComposed map: "); } -static bool affineApplyOp(Operation &op) { return isa(op); } - -static bool singleResultAffineApplyOpWithoutUses(Operation &op) { - auto app = dyn_cast(op); - return app && app.use_empty(); -} - /// Test for 'vectorizeAffineLoopNest' utility. void VectorizerTestPass::testVecAffineLoopNest() { std::vector> loops; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 8d112a8 - Remove TypedMatcherOps from VariantValue
Author: Stephen Kelly Date: 2021-01-19T22:39:58Z New Revision: 8d112a8eda9d78bc4c97cf7bc9e133afae7b6eed URL: https://github.com/llvm/llvm-project/commit/8d112a8eda9d78bc4c97cf7bc9e133afae7b6eed DIFF: https://github.com/llvm/llvm-project/commit/8d112a8eda9d78bc4c97cf7bc9e133afae7b6eed.diff LOG: Remove TypedMatcherOps from VariantValue It provides no features or advantage over ASTNodeKind-based handling. Differential Revision: https://reviews.llvm.org/D94876 Added: Modified: clang/include/clang/ASTMatchers/Dynamic/VariantValue.h clang/lib/ASTMatchers/Dynamic/VariantValue.cpp Removed: diff --git a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h index e47b42a4f38c..140b41dffc40 100644 --- a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h +++ b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -100,8 +100,7 @@ class VariantMatcher { /// Convert \p Matcher the destination type and return it as a new /// DynTypedMatcher. -virtual DynTypedMatcher -convertMatcher(const DynTypedMatcher &Matcher) const = 0; +DynTypedMatcher convertMatcher(const DynTypedMatcher &Matcher) const; /// Constructs a variadic typed matcher from \p InnerMatchers. /// Will try to convert each inner matcher to the destination type and @@ -110,9 +109,6 @@ class VariantMatcher { constructVariadicOperator(DynTypedMatcher::VariadicOperator Op, ArrayRef InnerMatchers) const; - protected: -~MatcherOps() = default; - private: ASTNodeKind NodeKind; }; @@ -174,8 +170,12 @@ class VariantMatcher { /// that can, the result would be ambiguous and false is returned. template bool hasTypedMatcher() const { +return hasTypedMatcher(ASTNodeKind::getFromNodeKind()); + } + + bool hasTypedMatcher(ASTNodeKind NK) const { if (!Value) return false; -return Value->getTypedMatcher(TypedMatcherOps()).hasValue(); +return Value->getTypedMatcher(MatcherOps(NK)).hasValue(); } /// Determines if the contained matcher can be converted to \p Kind. @@ -197,10 +197,15 @@ class VariantMatcher { template ast_matchers::internal::Matcher getTypedMatcher() const { assert(hasTypedMatcher() && "hasTypedMatcher() == false"); -return Value->getTypedMatcher(TypedMatcherOps()) +return Value->getTypedMatcher(MatcherOps(ASTNodeKind::getFromNodeKind())) ->template convertTo(); } + DynTypedMatcher getTypedMatcher(ASTNodeKind NK) const { +assert(hasTypedMatcher(NK) && "hasTypedMatcher(NK) == false"); +return *Value->getTypedMatcher(MatcherOps(NK)); + } + /// String representation of the type of the value. /// /// If the underlying matcher is a polymorphic one, the string will show all @@ -211,7 +216,6 @@ class VariantMatcher { explicit VariantMatcher(std::shared_ptr Value) : Value(std::move(Value)) {} - template struct TypedMatcherOps; class SinglePayload; class PolymorphicPayload; @@ -220,17 +224,6 @@ class VariantMatcher { std::shared_ptr Value; }; -template -struct VariantMatcher::TypedMatcherOps final : VariantMatcher::MatcherOps { - TypedMatcherOps() : MatcherOps(ASTNodeKind::getFromNodeKind()) {} - typedef ast_matchers::internal::Matcher MatcherT; - - DynTypedMatcher - convertMatcher(const DynTypedMatcher &Matcher) const override { -return DynTypedMatcher(Matcher.convertTo()); - } -}; - /// Variant value class. /// /// Basically, a tagged union with value type semantics. diff --git a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp index 866e2d0e3491..f31dda82a932 100644 --- a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp +++ b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp @@ -59,6 +59,11 @@ VariantMatcher::MatcherOps::canConstructFrom(const DynTypedMatcher &Matcher, return Matcher.canConvertTo(NodeKind); } +DynTypedMatcher VariantMatcher::MatcherOps::convertMatcher( +const DynTypedMatcher &Matcher) const { + return Matcher.dynCastTo(NodeKind); +} + llvm::Optional VariantMatcher::MatcherOps::constructVariadicOperator( DynTypedMatcher::VariadicOperator Op, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 18e093f - [msabi] Mangle a template argument referring to array-to-pointer decay
Author: Richard Smith Date: 2021-01-19T14:38:07-08:00 New Revision: 18e093faf726d15f210ab4917142beec51848258 URL: https://github.com/llvm/llvm-project/commit/18e093faf726d15f210ab4917142beec51848258 DIFF: https://github.com/llvm/llvm-project/commit/18e093faf726d15f210ab4917142beec51848258.diff LOG: [msabi] Mangle a template argument referring to array-to-pointer decay applied to an array the same as the array itself. This follows MS ABI, and corrects a regression from the implementation of generalized non-type template parameters, where we "forgot" how to mangle this case. Added: Modified: clang/lib/AST/MicrosoftMangle.cpp clang/test/CodeGenCXX/mangle-ms-templates.cpp Removed: diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 16e0aa2ae466..b9c289b6497a 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1466,6 +1466,21 @@ void MicrosoftCXXNameMangler::mangleTemplateArgs( } } +/// If value V (with type T) represents a decayed pointer to the first element +/// of an array, return that array. +static ValueDecl *getAsArrayToPointerDecayedDecl(QualType T, const APValue &V) { + // Must be a pointer... + if (!T->isPointerType() || !V.isLValue() || !V.hasLValuePath() || + !V.getLValueBase()) +return nullptr; + // ... to element 0 of an array. + QualType BaseT = V.getLValueBase().getType(); + if (!BaseT->isArrayType() || V.getLValuePath().size() != 1 || + V.getLValuePath()[0].getAsArrayIndex() != 0) +return nullptr; + return const_cast(V.getLValueBase().dyn_cast()); +} + void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD, const TemplateArgument &TA, const NamedDecl *Parm) { @@ -1576,6 +1591,14 @@ void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD, break; } case TemplateArgument::UncommonValue: +if (ValueDecl *D = getAsArrayToPointerDecayedDecl( +TA.getUncommonValueType(), TA.getAsUncommonValue())) { + // Mangle the result of array-to-pointer decay as if it were a reference + // to the original declaration, to match MSVC's behavior. This can result + // in mangling collisions in some cases! + return mangleTemplateArg( + TD, TemplateArgument(D, TA.getUncommonValueType()), Parm); +} Out << "$"; if (cast(Parm) ->getType() diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp index c9149a473b6f..a5ddb41461cc 100644 --- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -4,6 +4,20 @@ // RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s // RUN: %clang_cc1 -std=c++20 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix CXX20-X64 %s +// Check that array-to-pointer decay is mangled as the underlying declaration. +extern const char arr[4] = "foo"; +template struct Decay1 {}; +// CHECK: "?decay1@@3U?$Decay1@$1?arr@@3QBDB@@A" +Decay1 decay1; +#if __cplusplus >= 201702L +// Note that this mangling approach can lead to collisions. +template struct Decay2 {}; +// CXX20-X64: "?decay2a@@3U?$Decay2@$1?arr@@3QBDB@@A" +Decay2<(const void*)arr> decay2a; +// CXX20-X64: "?decay2b@@3U?$Decay2@$1?arr@@3QBDB@@A" +Decay2<(const void*)&arr> decay2b; +#endif + template class Class { public: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] e75a4b6 - [RISCV] Remove NotHasStdExtZbb predicate from zext.h/sext.b/sext.h InstAliases. NFC
Author: Craig Topper Date: 2021-01-19T14:31:48-08:00 New Revision: e75a4b6ea9e950181049f1c2f8a78835754852fe URL: https://github.com/llvm/llvm-project/commit/e75a4b6ea9e950181049f1c2f8a78835754852fe DIFF: https://github.com/llvm/llvm-project/commit/e75a4b6ea9e950181049f1c2f8a78835754852fe.diff LOG: [RISCV] Remove NotHasStdExtZbb predicate from zext.h/sext.b/sext.h InstAliases. NFC NotHasStdExtZbb doesn't have an AssemblerPredicate associated with it so it didn't do anything. We don't need it either because the sorting rules in tablegen prioritize by number of predicates. So the dedicated instructions in the B extension that have predicates will be prioritized automatically. Added: Modified: llvm/lib/Target/RISCV/RISCV.td llvm/lib/Target/RISCV/RISCVInstrInfo.td Removed: diff --git a/llvm/lib/Target/RISCV/RISCV.td b/llvm/lib/Target/RISCV/RISCV.td index 56339d7df52d..02424f6d86ff 100644 --- a/llvm/lib/Target/RISCV/RISCV.td +++ b/llvm/lib/Target/RISCV/RISCV.td @@ -126,7 +126,6 @@ def HasStdExtZbbOrZbp AssemblerPredicate<(any_of FeatureExtZbb, FeatureExtZbp)>; def NotHasStdExtZbbOrZbp : Predicate<"!(Subtarget->hasStdExtZbb() || Subtarget->hasStdExtZbp())">; -def NotHasStdExtZbb : Predicate<"!Subtarget->hasStdExtZbb()">; def FeatureExtZbproposedc : SubtargetFeature<"experimental-zbproposedc", "HasStdExtZbproposedc", "true", diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index 6b0967e12736..0210a29e2ab4 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -1074,19 +1074,19 @@ def PseudoLA_TLS_GD : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [], // There are single-instruction versions of these in Zbb, so disable these // Pseudos if that extension is present. -let Predicates = [NotHasStdExtZbb], hasSideEffects = 0, mayLoad = 0, +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 0, isAsmParserOnly = 1 in { def PseudoSEXT_B : Pseudo<(outs GPR:$rd), (ins GPR:$rs), [], "sext.b", "$rd, $rs">; def PseudoSEXT_H : Pseudo<(outs GPR:$rd), (ins GPR:$rs), [], "sext.h", "$rd, $rs">; // rv64's sext.w is defined above, using InstAlias<"sext.w ... // zext.b is defined above, using InstAlias<"zext.b ... def PseudoZEXT_H : Pseudo<(outs GPR:$rd), (ins GPR:$rs), [], "zext.h", "$rd, $rs">; -} // Predicates = [NotHasStdExtZbb], ... +} // hasSideEffects = 0, ... -let Predicates = [NotHasStdExtZbb, IsRV64], hasSideEffects = 0, mayLoad = 0, mayStore = 0, +let Predicates = [IsRV64], hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 0, isAsmParserOnly = 1 in { def PseudoZEXT_W : Pseudo<(outs GPR:$rd), (ins GPR:$rs), [], "zext.w", "$rd, $rs">; -} // Predicates = [NotHasStdExtZbb, IsRV64], ... +} // Predicates = [IsRV64], ... /// Loads ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] ecf6966 - [ASTMatchers] Allow use of mapAnyOf in more contexts
Author: Stephen Kelly Date: 2021-01-19T22:10:09Z New Revision: ecf696641e6ce4b22e8c8ea3c7476b9c1f0f200b URL: https://github.com/llvm/llvm-project/commit/ecf696641e6ce4b22e8c8ea3c7476b9c1f0f200b DIFF: https://github.com/llvm/llvm-project/commit/ecf696641e6ce4b22e8c8ea3c7476b9c1f0f200b.diff LOG: [ASTMatchers] Allow use of mapAnyOf in more contexts Add an operator overload to ArgumentAdaptingMatcherFunc to allow use of mapAnyOf within hasAncestor, hasParent etc. Differential Revision: https://reviews.llvm.org/D94864 Added: Modified: clang/include/clang/ASTMatchers/ASTMatchersInternal.h clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Removed: diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index aa78a893dcf6b..2af4e6e88109b 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1443,6 +1443,13 @@ struct ArgumentAdaptingMatcherFunc { operator()(const Matcher &InnerMatcher) const { return create(InnerMatcher); } + + template + ArgumentAdaptingMatcherFuncAdaptor::Type, ToTypes> + operator()(const MapAnyOfHelper &InnerMatcher) const { +return create(InnerMatcher.with()); + } }; template class TraversalMatcher : public MatcherInterface { diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp index b3582a02243a2..d681620cf5483 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -491,6 +491,17 @@ void F() { Code, traverse(TK_IgnoreUnlessSpelledInSource, mapAnyOf(ifStmt, forStmt).with(hasCondition(falseExpr); + EXPECT_TRUE( + matches(Code, cxxBoolLiteral(equals(true), + hasAncestor(mapAnyOf(ifStmt, forStmt); + + EXPECT_TRUE( + matches(Code, cxxBoolLiteral(equals(false), + hasAncestor(mapAnyOf(ifStmt, forStmt); + + EXPECT_TRUE( + notMatches(Code, floatLiteral(hasAncestor(mapAnyOf(ifStmt, forStmt); + Code = R"cpp( void func(bool b) {} struct S { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 3471455 - [lldb/test] Skip TestProcessAttach: test_attach_to_process_from_different_dir_by_id on Windows
Author: Stella Stamenova Date: 2021-01-19T14:09:09-08:00 New Revision: 347145538443347e705aaf1fb1473a5dcc5698e6 URL: https://github.com/llvm/llvm-project/commit/347145538443347e705aaf1fb1473a5dcc5698e6 DIFF: https://github.com/llvm/llvm-project/commit/347145538443347e705aaf1fb1473a5dcc5698e6.diff LOG: [lldb/test] Skip TestProcessAttach: test_attach_to_process_from_different_dir_by_id on Windows This test is flakey on Windows and on failure it hangs causing the test suite to fail and future builds (on the buildbot, especially) to fail because they cannot re-write the files that are currently in use Added: Modified: lldb/test/API/commands/process/attach/TestProcessAttach.py Removed: diff --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py b/lldb/test/API/commands/process/attach/TestProcessAttach.py index a3a97cfcef74..c224b9f109b3 100644 --- a/lldb/test/API/commands/process/attach/TestProcessAttach.py +++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py @@ -44,6 +44,7 @@ def test_attach_to_process_by_id(self): self.assertTrue(process, PROCESS_IS_VALID) @skipIfReproducer # FIXME: Unexpected packet during (active) replay +@skipIfWindows # This is flakey on Windows AND when it fails, it hangs: llvm.org/pr48806 def test_attach_to_process_from_ diff erent_dir_by_id(self): """Test attach by process id""" newdir = self.getBuildArtifact("newdir") ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] be7352c - [mlir][splitting std] move 2 more ops to `tensor`
Author: Sean Silva Date: 2021-01-19T13:49:25-08:00 New Revision: be7352c00d51f4358db3a23ed6a077f7cb48eafd URL: https://github.com/llvm/llvm-project/commit/be7352c00d51f4358db3a23ed6a077f7cb48eafd DIFF: https://github.com/llvm/llvm-project/commit/be7352c00d51f4358db3a23ed6a077f7cb48eafd.diff LOG: [mlir][splitting std] move 2 more ops to `tensor` - DynamicTensorFromElementsOp - TensorFromElements Differential Revision: https://reviews.llvm.org/D94994 Added: Modified: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td mlir/include/mlir/Dialect/Tensor/IR/Tensor.h mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td mlir/lib/Conversion/ShapeToStandard/CMakeLists.txt mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp mlir/lib/Dialect/StandardOps/IR/Ops.cpp mlir/lib/Dialect/StandardOps/Transforms/Bufferize.cpp mlir/lib/Dialect/Tensor/IR/CMakeLists.txt mlir/lib/Dialect/Tensor/IR/TensorOps.cpp mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp mlir/lib/Dialect/Tensor/Transforms/CMakeLists.txt mlir/lib/Dialect/Tensor/Transforms/PassDetail.h mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir mlir/test/Dialect/Standard/bufferize.mlir mlir/test/Dialect/Standard/canonicalize.mlir mlir/test/Dialect/Standard/invalid.mlir mlir/test/Dialect/Standard/ops.mlir mlir/test/Dialect/Tensor/bufferize.mlir mlir/test/Dialect/Tensor/canonicalize.mlir mlir/test/Dialect/Tensor/invalid.mlir mlir/test/Dialect/Tensor/ops.mlir mlir/test/IR/core-ops.mlir mlir/test/IR/invalid-ops.mlir mlir/test/Transforms/canonicalize.mlir Removed: diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td index 6eabe1179234..8e3f1f1a7a85 100644 --- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td +++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td @@ -1591,47 +1591,6 @@ def DivFOp : FloatArithmeticOp<"divf"> { let summary = "floating point division operation"; } -//===--===// -// DynamicTensorFromElementsOp -//===--===// - -def DynamicTensorFromElementsOp : Std_Op<"dynamic_tensor_from_elements", -[RecursiveSideEffects, SingleBlockImplicitTerminator<"YieldOp">]> { - string summary = "Creates a dynamically sized tensor from elements"; - string description = [{ -This operation creates a dynamically sized tensor with elements of any type. -It expects one index operand per dynamic extent of the result tensor. - -The body region defines the tensor's elements. It takes index operands as -its region arguments that span the index space. The element at the given -position is yielded with the `yield` operation (see `YieldOp`). There is -no defined ordering to the invocations of the body. It is conceptually -a "parallel map" operation. - -Example: - -```mlir - %tnsr = dynamic_tensor_from_elements %m, %n { - ^bb0(%i : index, %j : index, %k : index): -... -yield %elem : f32 - } : tensor -``` - }]; - - let arguments = (ins Variadic:$dynamicExtents); - let results = (outs AnyRankedTensor:$result); - let regions = (region SizedRegion<1>:$body); - - let builders = [ -// Build op and populate its body per callback function. -OpBuilderDAG<(ins "Type":$resultTy, "ValueRange":$dynamicExtents, - "function_ref")>, - ]; - - let hasCanonicalizer = 1; -} - //===--===// // ExpOp //===--===// @@ -1672,46 +1631,6 @@ def Exp2Op : FloatUnaryOp<"exp2"> { let summary = "base-2 exponential of the specified value"; } -//===--===// -// TensorFromElementsOp -//===--===// - -def TensorFromElementsOp : Std_Op<"tensor_from_elements", [ -NoSideEffect, -TypesMatchWith<"operand types match result element type", - "result", "elements", "SmallVector(" - "$_self.cast().getDimSize(0), " - "$_self.cast().getElementType())"> - ]> { - string summary = "tensor from elements operation."; - string description = [{ -Create a 1D tensor from a range of same-type arguments. - -Example: - -```mlir -tensor_from_elements(i_1, ..., i_N) : tensor -``` - }]; - - let arguments = (ins Variadic:$elements); - let results = (outs 1DTensorOf<[AnyType]>:$result); - - let assemblyFormat = "$elements attr-dict `:` type($result)"; - - // This op is fully verified by its traits. - let verifier = ?; - - let skipD
[llvm-branch-commits] [clang] ce24bb0 - [ASTMatchers] NFC Rearrange declarations to allow more arg adapting
Author: Stephen Kelly Date: 2021-01-19T21:32:42Z New Revision: ce24bb0eddab12460a01e4d91faa435f2fc84bb6 URL: https://github.com/llvm/llvm-project/commit/ce24bb0eddab12460a01e4d91faa435f2fc84bb6 DIFF: https://github.com/llvm/llvm-project/commit/ce24bb0eddab12460a01e4d91faa435f2fc84bb6.diff LOG: [ASTMatchers] NFC Rearrange declarations to allow more arg adapting Added: Modified: clang/include/clang/ASTMatchers/ASTMatchersInternal.h Removed: diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index f56cda318f4e..aa78a893dcf6 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1171,6 +1171,232 @@ using HasDeclarationSupportedTypes = TemplateSpecializationType, TemplateTypeParmType, TypedefType, UnresolvedUsingType, ObjCIvarRefExpr>; +/// A Matcher that allows binding the node it matches to an id. +/// +/// BindableMatcher provides a \a bind() method that allows binding the +/// matched node to an id if the match was successful. +template class BindableMatcher : public Matcher { +public: + explicit BindableMatcher(const Matcher &M) : Matcher(M) {} + explicit BindableMatcher(MatcherInterface *Implementation) + : Matcher(Implementation) {} + + /// Returns a matcher that will bind the matched node on a match. + /// + /// The returned matcher is equivalent to this matcher, but will + /// bind the matched node on a match. + Matcher bind(StringRef ID) const { +return DynTypedMatcher(*this) +.tryBind(ID) +->template unconditionalConvertTo(); + } + + /// Same as Matcher's conversion operator, but enables binding on + /// the returned matcher. + operator DynTypedMatcher() const { +DynTypedMatcher Result = static_cast &>(*this); +Result.setAllowBind(true); +return Result; + } +}; + +/// Matches any instance of the given NodeType. +/// +/// This is useful when a matcher syntactically requires a child matcher, +/// but the context doesn't care. See for example: anything(). +class TrueMatcher { +public: + using ReturnTypes = AllNodeBaseTypes; + + template operator Matcher() const { +return DynTypedMatcher::trueMatcher(ASTNodeKind::getFromNodeKind()) +.template unconditionalConvertTo(); + } +}; + +/// Creates a Matcher that matches if all inner matchers match. +template +BindableMatcher +makeAllOfComposite(ArrayRef *> InnerMatchers) { + // For the size() == 0 case, we return a "true" matcher. + if (InnerMatchers.empty()) { +return BindableMatcher(TrueMatcher()); + } + // For the size() == 1 case, we simply return that one matcher. + // No need to wrap it in a variadic operation. + if (InnerMatchers.size() == 1) { +return BindableMatcher(*InnerMatchers[0]); + } + + using PI = llvm::pointee_iterator *const *>; + + std::vector DynMatchers(PI(InnerMatchers.begin()), + PI(InnerMatchers.end())); + return BindableMatcher( + DynTypedMatcher::constructVariadic(DynTypedMatcher::VO_AllOf, + ASTNodeKind::getFromNodeKind(), + std::move(DynMatchers)) + .template unconditionalConvertTo()); +} + +/// Creates a Matcher that matches if +/// T is dyn_cast'able into InnerT and all inner matchers match. +/// +/// Returns BindableMatcher, as matchers that use dyn_cast have +/// the same object both to match on and to run submatchers on, +/// so there is no ambiguity with what gets bound. +template +BindableMatcher +makeDynCastAllOfComposite(ArrayRef *> InnerMatchers) { + return BindableMatcher( + makeAllOfComposite(InnerMatchers).template dynCastTo()); +} + +/// A VariadicDynCastAllOfMatcher object is a +/// variadic functor that takes a number of Matcher and returns a +/// Matcher that matches TargetT nodes that are matched by all of the +/// given matchers, if SourceT can be dynamically casted into TargetT. +/// +/// For example: +/// const VariadicDynCastAllOfMatcher record; +/// Creates a functor record(...) that creates a Matcher given +/// a variable number of arguments of type Matcher. +/// The returned matcher matches if the given Decl can by dynamically +/// casted to CXXRecordDecl and all given matchers match. +template +class VariadicDynCastAllOfMatcher +: public VariadicFunction, Matcher, + makeDynCastAllOfComposite> { +public: + VariadicDynCastAllOfMatcher() {} +}; + +/// A \c VariadicAllOfMatcher object is a variadic functor that takes +/// a number of \c Matcher and returns a \c Matcher that matches \c T +/// nodes that are matched by all of the given matchers. +/// +/// For example: +/// const VariadicAllOfMatcher nestedNameSpecifier; +/// Creates a functor nestedNameSpecifier(...) th
[llvm-branch-commits] [mlir] 894d88a - [mlir][python] Add facility for extending generated python ODS.
Author: Stella Laurenzo Date: 2021-01-19T13:20:26-08:00 New Revision: 894d88a759c9376de4a48ed99c965aac97839b6c URL: https://github.com/llvm/llvm-project/commit/894d88a759c9376de4a48ed99c965aac97839b6c DIFF: https://github.com/llvm/llvm-project/commit/894d88a759c9376de4a48ed99c965aac97839b6c.diff LOG: [mlir][python] Add facility for extending generated python ODS. * This isn't exclusive with other mechanisms for more ODS centric op definitions, but based on discussions, we feel that we will always benefit from a python escape hatch, and that is the most natural way to write things that don't fit the mold. * I suspect this facility needs further tweaking, and once it settles, I'll document it and add more tests. * Added extensions for linalg, since it is unusable without them and continued to evolve my e2e example. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D94752 Added: mlir/examples/python/.style.yapf mlir/lib/Bindings/Python/.style.yapf mlir/lib/Bindings/Python/mlir/dialects/_linalg.py Modified: mlir/examples/python/linalg_matmul.py mlir/lib/Bindings/Python/CMakeLists.txt mlir/lib/Bindings/Python/mlir/dialects/__init__.py mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp Removed: diff --git a/mlir/examples/python/.style.yapf b/mlir/examples/python/.style.yapf new file mode 100644 index ..9ef1dc15ba62 --- /dev/null +++ b/mlir/examples/python/.style.yapf @@ -0,0 +1,4 @@ +[style] + based_on_style = google + column_limit = 80 + indent_width = 2 diff --git a/mlir/examples/python/linalg_matmul.py b/mlir/examples/python/linalg_matmul.py index 83dc15eda9b6..e9be189bfaaf 100644 --- a/mlir/examples/python/linalg_matmul.py +++ b/mlir/examples/python/linalg_matmul.py @@ -15,59 +15,69 @@ # TODO: This should be in the core API. def FuncOp(name: str, func_type: Type) -> Tuple[Operation, Block]: -"""Creates a |func| op. + """Creates a |func| op. TODO: This should really be in the MLIR API. Returns: (operation, entry_block) """ -attrs = { -"type": TypeAttr.get(func_type), -"sym_name": StringAttr.get(name), -} -op = Operation.create("func", regions=1, attributes=attrs) -body_region = op.regions[0] -entry_block = body_region.blocks.append(*func_type.inputs) -return op, entry_block + attrs = { + "type": TypeAttr.get(func_type), + "sym_name": StringAttr.get(name), + } + op = Operation.create("func", regions=1, attributes=attrs) + body_region = op.regions[0] + entry_block = body_region.blocks.append(*func_type.inputs) + return op, entry_block -# TODO: Generate customs builder vs patching one in. -def PatchMatmulOpInit(self, lhs, rhs, result, loc=None, ip=None): -super(linalg.MatmulOp, self).__init__( -self._ods_build_default(operands=[[lhs, rhs], [result]], -results=[], -loc=loc, -ip=ip)) +def build_matmul_buffers_func(func_name, m, k, n, dtype): + lhs_type = MemRefType.get(dtype, [m, k]) + rhs_type = MemRefType.get(dtype, [k, n]) + result_type = MemRefType.get(dtype, [m, n]) + # TODO: There should be a one-liner for this. + func_type = FunctionType.get([lhs_type, rhs_type, result_type], []) + _, entry = FuncOp(func_name, func_type) + lhs, rhs, result = entry.arguments + with InsertionPoint(entry): +op = linalg.MatmulOp([lhs, rhs], [result]) # TODO: Implement support for SingleBlockImplicitTerminator -block = self.regions[0].blocks.append() +block = op.regions[0].blocks.append() with InsertionPoint(block): linalg.YieldOp(values=[]) -linalg.MatmulOp.__init__ = PatchMatmulOpInit +std.ReturnOp([]) -def build_matmul_func(func_name, m, k, n, dtype): -lhs_type = MemRefType.get(dtype, [m, k]) -rhs_type = MemRefType.get(dtype, [k, n]) -result_type = MemRefType.get(dtype, [m, n]) -# TODO: There should be a one-liner for this. -func_type = FunctionType.get([lhs_type, rhs_type, result_type], []) -_, entry = FuncOp(func_name, func_type) -lhs, rhs, result = entry.arguments -with InsertionPoint(entry): -linalg.MatmulOp(lhs, rhs, result) -std.ReturnOp([]) +def build_matmul_tensors_func(func_name, m, k, n, dtype): + # TODO: MemRefType and TensorTypes should not have inverted dtype/shapes + # from each other. + lhs_type = RankedTensorType.get([m, k], dtype) + rhs_type = RankedTensorType.get([k, n], dtype) + result_type = RankedTensorType.get([m, n], dtype) + # TODO: There should be a one-liner for this. + func_type = FunctionType.get([lhs_type, rhs_type], [result_type]) + _, entry = FuncOp(func_name, func_type) + lhs, rhs = entry.arguments + with InsertionPoint(entry): +op = linalg.MatmulOp([lhs, rhs], results=[result_type]) +# TODO: Implement support for SingleB
[llvm-branch-commits] [lld] b99147b - [lld][WebAssembly] Don't defined indirect function table in relocatable output
Author: Sam Clegg Date: 2021-01-19T12:59:20-08:00 New Revision: b99147b4fa7b361fba4eeefdb443dca72b8ee87f URL: https://github.com/llvm/llvm-project/commit/b99147b4fa7b361fba4eeefdb443dca72b8ee87f DIFF: https://github.com/llvm/llvm-project/commit/b99147b4fa7b361fba4eeefdb443dca72b8ee87f.diff LOG: [lld][WebAssembly] Don't defined indirect function table in relocatable output Object files (and the output --relocatable) should never define __indirect_function_table. It should always be linker synthesized with the final output executable. Differential Revision: https://reviews.llvm.org/D94993 Added: Modified: lld/test/wasm/locals-duplicate.test lld/test/wasm/relocatable.ll lld/test/wasm/signature-mismatch.ll lld/test/wasm/weak-alias.ll lld/wasm/Driver.cpp Removed: diff --git a/lld/test/wasm/locals-duplicate.test b/lld/test/wasm/locals-duplicate.test index cf9a148d4ab7..1d704ec2dff1 100644 --- a/lld/test/wasm/locals-duplicate.test +++ b/lld/test/wasm/locals-duplicate.test @@ -231,17 +231,19 @@ ; RELOC-NEXT: ParamTypes: [] ; RELOC-NEXT: ReturnTypes: ; RELOC-NEXT: - I32 +; RELOC-NEXT: - Type:IMPORT +; RELOC-NEXT:Imports: +; RELOC-NEXT: - Module: env +; RELOC-NEXT:Field: __indirect_function_table +; RELOC-NEXT:Kind:TABLE +; RELOC-NEXT:Table: +; RELOC-NEXT: Index: 0 +; RELOC-NEXT: ElemType:FUNCREF +; RELOC-NEXT: Limits: +; RELOC-NEXT:Initial: 0x3 ; RELOC-NEXT: - Type:FUNCTION ; RELOC-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; RELOC-NEXT:0, 0 ] -; RELOC-NEXT: - Type:TABLE -; RELOC-NEXT: Tables: -; RELOC-NEXT: - Index: 0 -; RELOC-NEXT: ElemType:FUNCREF -; RELOC-NEXT: Limits: -; RELOC-NEXT: Flags: [ HAS_MAX ] -; RELOC-NEXT: Initial: 0x7 -; RELOC-NEXT: Maximum: 0x7 ; RELOC-NEXT: - Type:MEMORY ; RELOC-NEXT: Memories: ; RELOC-NEXT: - Initial: 0x1 @@ -412,7 +414,7 @@ ; RELOC-NEXT: - Index: 8 ; RELOC-NEXT: Kind:TABLE ; RELOC-NEXT: Name:__indirect_function_table -; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] +; RELOC-NEXT: Flags: [ UNDEFINED, NO_STRIP ] ; RELOC-NEXT: Table: 0 ; RELOC-NEXT: - Index: 9 ; RELOC-NEXT: Kind:FUNCTION diff --git a/lld/test/wasm/relocatable.ll b/lld/test/wasm/relocatable.ll index e8129da9ad3d..7de51a38f5c9 100644 --- a/lld/test/wasm/relocatable.ll +++ b/lld/test/wasm/relocatable.ll @@ -1,7 +1,10 @@ ; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hello.s -o %t.hello.o ; RUN: llc -filetype=obj %s -o %t.o -; RUN: wasm-ld -r -o %t.wasm %t.hello.o %t.o -; RUN: obj2yaml %t.wasm | FileCheck %s +; RUN: wasm-ld -r -o %t2.o %t.hello.o %t.o +; RUN: obj2yaml %t2.o | FileCheck %s + +; Verify the resulting object can be used as linker input +; RUN: wasm-ld --allow-undefined -o %t.wasm %t2.o --export-table target triple = "wasm32-unknown-unknown" @@ -32,6 +35,11 @@ entry: ; Test that __attribute__(used) (i.e NO_STRIP) is preserved in the relocated symbol table @llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @my_func to i8*)], section "llvm.metadata" +define void @_start() { + ret void +} + + ; CHECK: --- !WASM ; CHECK-NEXT: FileHeader: ; CHECK-NEXT: Version: 0x1 @@ -63,16 +71,16 @@ entry: ; CHECK-NEXT: Field: bar_import ; CHECK-NEXT: Kind:FUNCTION ; CHECK-NEXT: SigIndex:1 +; CHECK-NEXT: - Module: env +; CHECK-NEXT: Field: __indirect_function_table +; CHECK-NEXT: Kind:TABLE +; CHECK-NEXT: Table: +; CHECK-NEXT: Index: 0 +; CHECK-NEXT: ElemType:FUNCREF +; CHECK-NEXT: Limits: +; CHECK-NEXT: Initial: 0x3 ; CHECK-NEXT: - Type:FUNCTION -; CHECK-NEXT: FunctionTypes: [ 2, 1, 1 ] -; CHECK-NEXT: - Type:TABLE -; CHECK-NEXT: Tables: -; CHECK-NEXT: - Index: 0 -; CHECK-NEXT: ElemType:FUNCREF -; CHECK-NEXT: Limits: -; CHECK-NEXT: Flags: [ HAS_MAX ] -; CHECK-NEXT: Initial: 0x4 -; CHECK-NEXT: Maximum: 0x4 +; CHECK-NEXT: FunctionTypes: [ 2, 1, 1, 2 ] ; CHECK-NEXT: - Type:MEMORY ; CHECK-NEXT: Memories: ; CHECK-NEXT: - Initial: 0x1 diff --git a/lld/test/wasm/signature-mismatch.ll b/lld/test/wasm/signature-mismatch.ll index 65ce73910ffa..931
[llvm-branch-commits] [libc] 7bd3702 - [libc] Extend the current fenv functions to aarch64.
Author: Siva Chandra Date: 2021-01-19T12:47:54-08:00 New Revision: 7bd3702b64043fb623bf82c1d1a8a2d168142219 URL: https://github.com/llvm/llvm-project/commit/7bd3702b64043fb623bf82c1d1a8a2d168142219 DIFF: https://github.com/llvm/llvm-project/commit/7bd3702b64043fb623bf82c1d1a8a2d168142219.diff LOG: [libc] Extend the current fenv functions to aarch64. This change does not try to move the common parts of x86 and aarch64 and build few abstractions over them. While this is possible, x86 story needs a bit of cleanup, especially around manipulation of the mxcsr register. Moreover, on x86 one can raise exceptions without performing exception raising operations. So, all of this can be done in follow up patches. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D94947 Added: libc/utils/FPUtil/aarch64/FEnv.h Modified: libc/config/linux/aarch64/entrypoints.txt libc/utils/FPUtil/FEnv.h Removed: diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index 4e20903ad260..ca7252b17e64 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -20,6 +20,13 @@ set(TARGET_LIBC_ENTRYPOINTS # errno.h entrypoints libc.src.errno.__errno_location +# fenv.h entrypoints +libc.src.fenv.feclearexcept +libc.src.fenv.fegetround +libc.src.fenv.fesetround +libc.src.fenv.feraiseexcept +libc.src.fenv.fetestexcept + # stdlib.h entrypoints libc.src.stdlib.abs libc.src.stdlib.labs diff --git a/libc/utils/FPUtil/FEnv.h b/libc/utils/FPUtil/FEnv.h index bf520672161e..1634f5f10125 100644 --- a/libc/utils/FPUtil/FEnv.h +++ b/libc/utils/FPUtil/FEnv.h @@ -11,6 +11,8 @@ #ifdef __x86_64__ #include "x86_64/FEnv.h" +#elif defined(__aarch64__) +#include "aarch64/FEnv.h" #else #include "DummyFEnv.h" #endif diff --git a/libc/utils/FPUtil/aarch64/FEnv.h b/libc/utils/FPUtil/aarch64/FEnv.h new file mode 100644 index ..ac0ef70b522d --- /dev/null +++ b/libc/utils/FPUtil/aarch64/FEnv.h @@ -0,0 +1,204 @@ +//===-- aarch64 floating point env manipulation functions ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_LIBC_UTILS_FPUTIL_AARCH64_FENV_H +#define LLVM_LIBC_UTILS_FPUTIL_AARCH64_FENV_H + +#include +#include +#include + +#include "utils/FPUtil/FPBits.h" + +namespace __llvm_libc { +namespace fputil { + +struct FEnv { + static constexpr uint32_t ToNearest = 0x0; + static constexpr uint32_t Upward = 0x1; + static constexpr uint32_t Downward = 0x2; + static constexpr uint32_t TowardZero = 0x3; + + static constexpr uint32_t Invalid = 0x1; + static constexpr uint32_t DivByZero = 0x2; + static constexpr uint32_t Overflow = 0x4; + static constexpr uint32_t Underflow = 0x8; + static constexpr uint32_t Inexact = 0x10; + + // Zero-th bit is the first bit. + static constexpr uint32_t RoundingControlBitPosition = 22; + static constexpr uint32_t ExceptionStatusFlagsBitPosition = 0; + static constexpr uint32_t ExceptionControlFlagsBitPosition = 8; + + static inline uint32_t getStatusValueForExcept(int excepts) { +return (excepts & FE_INVALID ? Invalid : 0) | + (excepts & FE_DIVBYZERO ? DivByZero : 0) | + (excepts & FE_OVERFLOW ? Overflow : 0) | + (excepts & FE_UNDERFLOW ? Underflow : 0) | + (excepts & FE_INEXACT ? Inexact : 0); + } + + static inline int exceptionStatusToMacro(uint32_t status) { +return (status & Invalid ? FE_INVALID : 0) | + (status & DivByZero ? FE_DIVBYZERO : 0) | + (status & Overflow ? FE_OVERFLOW : 0) | + (status & Underflow ? FE_UNDERFLOW : 0) | + (status & Inexact ? FE_INEXACT : 0); + } + + static uint32_t getControlWord() { return __arm_rsr("fpcr"); } + + static void writeControlWord(uint32_t fpcr) { __arm_wsr("fpcr", fpcr); } + + static uint32_t getStatusWord() { return __arm_rsr("fpsr"); } + + static void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } +}; + +static inline int enableExcept(int excepts) { + uint32_t newExcepts = FEnv::getStatusValueForExcept(excepts); + uint32_t controlWord = FEnv::getControlWord(); + int oldExcepts = + (controlWord >> FEnv::ExceptionControlFlagsBitPosition) & 0x1F; + controlWord |= (newExcepts << FEnv::ExceptionControlFlagsBitPosition); + FEnv::writeControlWord(controlWord); + return FEnv::exceptionStatusToMacro(oldExcepts); +} + +static inline int disableExcept(int excepts) { + uint32_t disabledExcepts = FEnv::getStatusValueForExcept(excepts); + uint32_t controlWord = FEnv::getControlWord(); + int oldExcepts
[llvm-branch-commits] [clang] 5a684b7 - Ensure we don't strip the ConstantExpr carrying a non-type template
Author: Richard Smith Date: 2021-01-19T12:48:39-08:00 New Revision: 5a684b70dc74f9f671f8eb61993a25769ec68117 URL: https://github.com/llvm/llvm-project/commit/5a684b70dc74f9f671f8eb61993a25769ec68117 DIFF: https://github.com/llvm/llvm-project/commit/5a684b70dc74f9f671f8eb61993a25769ec68117.diff LOG: Ensure we don't strip the ConstantExpr carrying a non-type template argument's value off it during substitution. Added: Modified: clang/lib/Sema/SemaTemplateInstantiate.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp Removed: diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 7679063ead71..7d7591ab669c 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1597,7 +1597,9 @@ TemplateInstantiator::TransformSubstNonTypeTemplateParmPackExpr( ExprResult TemplateInstantiator::TransformSubstNonTypeTemplateParmExpr( SubstNonTypeTemplateParmExpr *E) { - ExprResult SubstReplacement = TransformExpr(E->getReplacement()); + ExprResult SubstReplacement = E->getReplacement(); + if (!isa(SubstReplacement.get())) +SubstReplacement = TransformExpr(E->getReplacement()); if (SubstReplacement.isInvalid()) return true; QualType SubstType = TransformType(E->getParameterType(getSema().Context)); diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp index bc8a22e89041..4d61b9c7d937 100644 --- a/clang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp +++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp @@ -511,3 +511,18 @@ namespace dependent_reference { // Ensure that we can instantiate the definition of S<...>. int n = *v.q + *w.q; } + +namespace decay { + template struct X { +template void f(const X &v) {} + }; + struct A { +static constexpr const char *arr[] = {"hello", "world"}; +static constexpr int count = 2; + }; + void f() { +X x1; +X x2; +x1.f(x2); + } +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] da98651 - Revert "DR2064: decltype(E) is only a dependent type if E is type-dependent, not
Author: Richard Smith Date: 2021-01-19T12:48:40-08:00 New Revision: da986511fb9da1a46a0ca4dba2e49e2426036303 URL: https://github.com/llvm/llvm-project/commit/da986511fb9da1a46a0ca4dba2e49e2426036303 DIFF: https://github.com/llvm/llvm-project/commit/da986511fb9da1a46a0ca4dba2e49e2426036303.diff LOG: Revert "DR2064: decltype(E) is only a dependent type if E is type-dependent, not if E is merely instantiation-dependent." This change leaves us unable to distinguish between different function templates that differ in only instantiation-dependent ways, for example template decltype(int(T())) f(); template decltype(int(T(0))) f(); We'll need substantially better support for types that are instantiation-dependent but not dependent before we can go ahead with this change. This reverts commit e3065ce238475ec202c707f4c58d90df171626ca. Added: Modified: clang/include/clang/AST/DependenceFlags.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/Type.cpp clang/test/CXX/drs/dr20xx.cpp clang/test/CodeGenCXX/mangle-subst.cpp clang/test/Sema/invalid-bitwidth-expr.mm clang/test/SemaCXX/coroutines.cpp clang/test/SemaCXX/invalid-template-base-specifier.cpp clang/test/SemaTemplate/dependent-expr.cpp clang/test/SemaTemplate/temp_arg_template_cxx1z.cpp clang/www/cxx_dr_status.html Removed: diff --git a/clang/include/clang/AST/DependenceFlags.h b/clang/include/clang/AST/DependenceFlags.h index 8c47047a7526..ca96b65574bd 100644 --- a/clang/include/clang/AST/DependenceFlags.h +++ b/clang/include/clang/AST/DependenceFlags.h @@ -255,12 +255,6 @@ inline TypeDependence toTypeDependence(TemplateNameDependence D) { inline TypeDependence toTypeDependence(TemplateArgumentDependence D) { return Dependence(D).type(); } -/// Compute the dependence of a type that depends on the type of an expression, -/// given the dependence of that expression and of its type. -inline TypeDependence typeToTypeDependence(ExprDependence ED, TypeDependence TD) { - return Dependence(ED & ~ExprDependence::Value).type() | - (TD & TypeDependence::VariablyModified); -} inline NestedNameSpecifierDependence toNestedNameSpecifierDependendence(TypeDependence D) { diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d396f81188df..c482235caaed 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -5383,10 +5383,10 @@ QualType ASTContext::getDecltypeType(Expr *e, QualType UnderlyingType) const { DecltypeType *dt; // C++11 [temp.type]p2: - // If an expression e is type-dependent, decltype(e) denotes a unique - // dependent type. Two such decltype-specifiers refer to the same type only - // if their expressions are equivalent (14.5.6.1). - if (e->isTypeDependent()) { + // If an expression e involves a template parameter, decltype(e) denotes a + // unique dependent type. Two such decltype-specifiers refer to the same + // type only if their expressions are equivalent (14.5.6.1). + if (e->isInstantiationDependent()) { llvm::FoldingSetNodeID ID; DependentDecltypeType::Profile(ID, *this, e); diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index e7db8e2baa84..27aa622e00e9 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2578,11 +2578,6 @@ void CXXNameMangler::mangleType(QualType T) { if (!TST->isTypeAlias()) break; - // Don't desugar instantiation-dependent decltype / typeof types. We need - // to mangle the expression as written. - if (isa(T)) -break; - // FIXME: We presumably shouldn't strip off ElaboratedTypes with // instantation-dependent qualifiers. See // https://github.com/itanium-cxx-abi/cxx-abi/issues/114. @@ -5612,11 +5607,12 @@ static bool hasMangledSubstitutionQualifiers(QualType T) { bool CXXNameMangler::mangleSubstitution(QualType T) { if (!hasMangledSubstitutionQualifiers(T)) { -if (const RecordType *RT = dyn_cast(T)) +if (const RecordType *RT = T->getAs()) return mangleSubstitution(RT->getDecl()); } uintptr_t TypePtr = reinterpret_cast(T.getAsOpaquePtr()); + return mangleSubstitution(TypePtr); } @@ -5775,7 +5771,7 @@ bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) { void CXXNameMangler::addSubstitution(QualType T) { if (!hasMangledSubstitutionQualifiers(T)) { -if (const RecordType *RT = dyn_cast(T)) { +if (const RecordType *RT = T->getAs()) { addSubstitution(RT->getDecl()); return; } diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 5dec80be9ccb..034e175f1352 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -125,7 +125,8 @@ ArrayType::ArrayType(TypeClass tc, QualType et, QualType can, // template int arr
[llvm-branch-commits] [clang] b272698 - [OPENMP]Do not use OMP_MAP_TARGET_PARAM for data movement directives.
Author: Alexey Bataev Date: 2021-01-19T12:41:15-08:00 New Revision: b272698de790d6603db7992c0c0ad6446b7a52b8 URL: https://github.com/llvm/llvm-project/commit/b272698de790d6603db7992c0c0ad6446b7a52b8 DIFF: https://github.com/llvm/llvm-project/commit/b272698de790d6603db7992c0c0ad6446b7a52b8.diff LOG: [OPENMP]Do not use OMP_MAP_TARGET_PARAM for data movement directives. OMP_MAP_TARGET_PARAM flag is used to mark the data that shoud be passed as arguments to the target kernels, nothing else. But the compiler still marks the data with OMP_MAP_TARGET_PARAM flags even if the data is passed to the data movement directives, like target data, target update etc. This flag is just ignored for this directives and the compiler does not need to emit it. Reviewed By: cchen Differential Revision: https://reviews.llvm.org/D91261 Added: Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/test/OpenMP/declare_mapper_codegen.cpp clang/test/OpenMP/target_data_codegen.cpp clang/test/OpenMP/target_data_map_pointer_array_subscript_codegen.cpp clang/test/OpenMP/target_data_use_device_addr_codegen.cpp clang/test/OpenMP/target_data_use_device_ptr_codegen.cpp clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp clang/test/OpenMP/target_enter_data_codegen.cpp clang/test/OpenMP/target_enter_data_depend_codegen.cpp clang/test/OpenMP/target_exit_data_codegen.cpp clang/test/OpenMP/target_exit_data_depend_codegen.cpp clang/test/OpenMP/target_map_member_expr_array_section_codegen.cpp clang/test/OpenMP/target_update_codegen.cpp clang/test/OpenMP/target_update_depend_codegen.cpp Removed: diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 17fa56fb06c8..22df862db1b5 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -8233,7 +8233,7 @@ class MappableExprsHandler { MapFlagsArrayTy &CurTypes, const StructRangeInfoTy &PartialStruct, const ValueDecl *VD = nullptr, - bool NotTargetParams = false) const { + bool NotTargetParams = true) const { if (CurTypes.size() == 1 && ((CurTypes.back() & OMP_MAP_MEMBER_OF) != OMP_MAP_MEMBER_OF) && !PartialStruct.IsArraySection) @@ -8284,7 +8284,7 @@ class MappableExprsHandler { /// pair of the relevant declaration and index where it occurs is appended to /// the device pointers info array. void generateAllInfo( - MapCombinedInfoTy &CombinedInfo, bool NotTargetParams = false, + MapCombinedInfoTy &CombinedInfo, const llvm::DenseSet> &SkipVarSet = llvm::DenseSet>()) const { // We have to process the component lists that relate with the same @@ -8420,9 +8420,7 @@ class MappableExprsHandler { UseDevicePtrCombinedInfo.Pointers.push_back(Ptr); UseDevicePtrCombinedInfo.Sizes.push_back( llvm::Constant::getNullValue(CGF.Int64Ty)); - UseDevicePtrCombinedInfo.Types.push_back( - OMP_MAP_RETURN_PARAM | - (NotTargetParams ? OMP_MAP_NONE : OMP_MAP_TARGET_PARAM)); + UseDevicePtrCombinedInfo.Types.push_back(OMP_MAP_RETURN_PARAM); UseDevicePtrCombinedInfo.Mappers.push_back(nullptr); } } @@ -8490,19 +8488,13 @@ class MappableExprsHandler { CombinedInfo.Pointers.push_back(Ptr); CombinedInfo.Sizes.push_back( llvm::Constant::getNullValue(CGF.Int64Ty)); - CombinedInfo.Types.push_back( - OMP_MAP_RETURN_PARAM | - (NotTargetParams ? OMP_MAP_NONE : OMP_MAP_TARGET_PARAM)); + CombinedInfo.Types.push_back(OMP_MAP_RETURN_PARAM); CombinedInfo.Mappers.push_back(nullptr); } } } for (const auto &M : Info) { - // We need to know when we generate information for the first component - // associated with a capture, because the mapping flags depend on it. - bool IsFirstComponentList = !NotTargetParams; - // Underlying variable declaration used in the map clause. const ValueDecl *VD = std::get<0>(M); @@ -8520,8 +8512,8 @@ class MappableExprsHandler { L.Components.back().isNonContiguous(); generateInfoForComponentList( L.MapType, L.MapModifiers, L.MotionModifiers, L.Components, CurInfo, -PartialStruct, IsFirstComponentList, L.IsImplicit, L.Mapper, -L.ForDeviceAddr, VD, L.VarRef); +PartialStruct, /*IsFirstComponentList=*/false, L.IsImplicit, +L.Mapper, L.ForDeviceAddr, VD, L.VarRef); // If this entry relates with a device pointer, set the relevant // declaration and add the 'return pointer' flag. @@ -8538,7 +8530,6 @@ class MappableExprsHandler {
[llvm-branch-commits] [polly] cabe1b1 - [polly][NewPM][test] Fix polly tests under -enable-new-pm
Author: Arthur Eubanks Date: 2021-01-19T12:38:58-08:00 New Revision: cabe1b11243740d39c0b49c10a8ce86001b1011c URL: https://github.com/llvm/llvm-project/commit/cabe1b11243740d39c0b49c10a8ce86001b1011c DIFF: https://github.com/llvm/llvm-project/commit/cabe1b11243740d39c0b49c10a8ce86001b1011c.diff LOG: [polly][NewPM][test] Fix polly tests under -enable-new-pm In preparation for turning on opt's -enable-new-pm by default, this pins uses of passes via the legacy "opt -passname" with pass names beginning with "polly-" and "polyhedral-info" to the legacy PM. Many of these tests use -analyze, which isn't supported in the new PM. (This doesn't affect uses of "opt -passes=passname"). rL240766 accidentally removed `-polly-prepare` in phi_not_grouped_at_top.ll, and it also doesn't use the output of -analyze. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D94266 Added: Modified: llvm/tools/opt/opt.cpp polly/test/ScopInfo/phi_not_grouped_at_top.ll Removed: diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 99197a8b5fd4..92df0bc19a30 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -480,30 +480,22 @@ static bool shouldPinPassToLegacyPM(StringRef Pass) { return false; std::vector PassNamePrefix = { - "x86-", "xcore-", "wasm-","systemz-", "ppc-", "nvvm-", "nvptx-", - "mips-", "lanai-", "hexagon-", "bpf-", "avr-", "thumb2-", "arm-", - "si-", "gcn-", "amdgpu-", "aarch64-", "amdgcn-"}; + "x86-", "xcore-", "wasm-","systemz-", "ppc-","nvvm-", "nvptx-", + "mips-", "lanai-", "hexagon-", "bpf-", "avr-","thumb2-", "arm-", + "si-", "gcn-", "amdgpu-", "aarch64-", "amdgcn-", "polly-"}; std::vector PassNameContain = {"ehprepare"}; - std::vector PassNameExact = {"safe-stack", - "cost-model", - "codegenprepare", - "interleaved-load-combine", - "unreachableblockelim", - "verify-safepoint-ir", - "divergence", - "atomic-expand", - "hardware-loops", - "type-promotion", - "mve-tail-predication", - "interleaved-access", - "global-merge", - "pre-isel-intrinsic-lowering", - "expand-reductions", - "indirectbr-expand", - "generic-to-nvvm", - "expandmemcmp", - "loop-reduce", - "lower-amx-type"}; + std::vector PassNameExact = { + "safe-stack", "cost-model", + "codegenprepare", "interleaved-load-combine", + "unreachableblockelim", "verify-safepoint-ir", + "divergence", "atomic-expand", + "hardware-loops", "type-promotion", + "mve-tail-predication", "interleaved-access", + "global-merge", "pre-isel-intrinsic-lowering", + "expand-reductions","indirectbr-expand", + "generic-to-nvvm", "expandmemcmp", + "loop-reduce", "lower-amx-type", + "polyhedral-info"}; for (const auto &P : PassNamePrefix) if (Pass.startswith(P)) return true; diff --git a/polly/test/ScopInfo/phi_not_grouped_at_top.ll b/polly/test/ScopInfo/phi_not_grouped_at_top.ll index a5a80171a2e6..480c22d95569 100644 --- a/polly/test/ScopInfo/phi_not_grouped_at_top.ll +++ b/polly/test/ScopInfo/phi_not_grouped_at_top.ll @@ -1,4 +1,4 @@ -; RUN: opt %loadPolly -analyze < %s +; RUN: opt %loadPolly -polly-prepare < %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" declare i32 @funa() align 2 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 27afc09 - [NFC] Disallow unused prefixes under Other
Author: Mircea Trofin Date: 2021-01-19T12:22:29-08:00 New Revision: 27afc091e2c0caa954326129adb86987d1b41c91 URL: https://github.com/llvm/llvm-project/commit/27afc091e2c0caa954326129adb86987d1b41c91 DIFF: https://github.com/llvm/llvm-project/commit/27afc091e2c0caa954326129adb86987d1b41c91.diff LOG: [NFC] Disallow unused prefixes under Other Differential Revision: https://reviews.llvm.org/D94853 Added: llvm/test/Other/lit.local.cfg Modified: llvm/test/Other/new-pass-manager.ll llvm/test/Other/opt-LTO-pipeline.ll llvm/test/Other/opt-bisect-legacy-pass-manager.ll llvm/test/Other/print-slotindexes.ll Removed: diff --git a/llvm/test/Other/lit.local.cfg b/llvm/test/Other/lit.local.cfg new file mode 100644 index 0..1b775f32afe07 --- /dev/null +++ b/llvm/test/Other/lit.local.cfg @@ -0,0 +1,12 @@ +from lit.llvm.subst import ToolSubst + +fc = ToolSubst('FileCheck', unresolved='fatal') +# Insert this first. Then, we'll first update the blank FileCheck command; then, +# the default substitution of FileCheck will replace it to its full path. +config.substitutions.insert(0, (fc.regex, +'FileCheck --allow-unused-prefixes=false')) + +# FIXME: this substitution should be removed together with the above, when the +# default --allow-unused-prefixes is fixed. At that point, the use of %FileCheckRaw% +# in opt-bisect-legacy-pass-manager.ll should be switched back to just FileCheck. +config.substitutions.append(('%FileCheckRaw%', 'FileCheck')) diff --git a/llvm/test/Other/new-pass-manager.ll b/llvm/test/Other/new-pass-manager.ll index 1206f2c4b5dc4..f1e3702145bd7 100644 --- a/llvm/test/Other/new-pass-manager.ll +++ b/llvm/test/Other/new-pass-manager.ll @@ -366,6 +366,9 @@ ; CHECK-EXT-NEXT: Starting llvm::Function pass manager run. ; CHECK-EXT-NEXT: Running pass: {{.*}}Bye ; CHECK-EXT-NEXT: Finished llvm::Function pass manager run. +; We don't have checks for CHECK-NOEXT here, but this simplifies the test, while +; avoiding FileCheck complaining about the unused prefix. +; CHECK-NOEXT: {{.*}} ; CHECK-O0-NEXT: Finished llvm::Module pass manager run ; RUN: opt -disable-output -disable-verify -debug-pass-manager \ diff --git a/llvm/test/Other/opt-LTO-pipeline.ll b/llvm/test/Other/opt-LTO-pipeline.ll index a3de1b9de3f9c..14f6329b2540b 100644 --- a/llvm/test/Other/opt-LTO-pipeline.ll +++ b/llvm/test/Other/opt-LTO-pipeline.ll @@ -1,4 +1,4 @@ -; RUN: opt -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK,%llvmcheckext %s +; RUN: opt -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK %s ; REQUIRES: asserts diff --git a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll index 8d966deeccd70..decd9db6636f8 100644 --- a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll +++ b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll @@ -39,7 +39,7 @@ ; f2() in f3(). ; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \ -; RUN: --filecheckcmd=FileCheck --test=%s \ +; RUN: --filecheckcmd=%FileCheckRaw% --test=%s \ ; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \ ; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT ; The helper script uses this to find the optimization that inlines the call. diff --git a/llvm/test/Other/print-slotindexes.ll b/llvm/test/Other/print-slotindexes.ll index 722a3dc5a9389..cc0abb75a59b0 100644 --- a/llvm/test/Other/print-slotindexes.ll +++ b/llvm/test/Other/print-slotindexes.ll @@ -1,5 +1,5 @@ -; RUN: llc -print-after=slotindexes < %s 2>&1 | FileCheck %s --check-prefixes=ALL,SI -; RUN: llc -print-after=slotindexes -print-slotindexes=false < %s 2>&1 | FileCheck %s --check-prefixes=ALL,NOSI +; RUN: llc -print-after=slotindexes < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,SI +; RUN: llc -print-after=slotindexes -print-slotindexes=false < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,NOSI ; REQUIRES: default_triple define void @foo(){ ret void ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] e463bd5 - Revert "[SLP]Merge reorder and reuse shuffles."
Author: Alexey Bataev Date: 2021-01-19T11:48:04-08:00 New Revision: e463bd53c03ff9183bd30030477dfe6f3b2fdd0c URL: https://github.com/llvm/llvm-project/commit/e463bd53c03ff9183bd30030477dfe6f3b2fdd0c DIFF: https://github.com/llvm/llvm-project/commit/e463bd53c03ff9183bd30030477dfe6f3b2fdd0c.diff LOG: Revert "[SLP]Merge reorder and reuse shuffles." This reverts commit 438682de6a38ac97f89fa38faf5c8dc9b09cd9ad to fix the bug with the reducing size of the resulting vector for the entry node with multiple users. Added: Modified: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp llvm/test/Transforms/SLPVectorizer/AArch64/PR38339.ll llvm/test/Transforms/SLPVectorizer/X86/PR32086.ll llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll Removed: diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 0fee52dcdd93..24885e4d8257 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -3500,7 +3500,6 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { case Instruction::ExtractValue: case Instruction::ExtractElement: { - InstructionCost DeadCost = 0; if (NeedToShuffleReuses) { unsigned Idx = 0; for (unsigned I : E->ReuseShuffleIndices) { @@ -3528,10 +3527,12 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { ReuseShuffleCost += TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, Idx); } -DeadCost = ReuseShuffleCost; - } else if (!E->ReorderIndices.empty()) { -DeadCost = TTI->getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, - VecTy); + } + InstructionCost DeadCost = ReuseShuffleCost; + if (!E->ReorderIndices.empty()) { +// TODO: Merge this shuffle with the ReuseShuffleCost. +DeadCost += TTI->getShuffleCost( +TargetTransformInfo::SK_PermuteSingleSrc, VecTy); } for (unsigned I = 0, E = VL.size(); I < E; ++I) { Instruction *EI = cast(VL[I]); @@ -3755,9 +3756,11 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { Instruction::Load, VecTy, cast(VL0)->getPointerOperand(), /*VariableMask=*/false, alignment, CostKind, VL0); } - if (!NeedToShuffleReuses && !E->ReorderIndices.empty()) + if (!E->ReorderIndices.empty()) { +// TODO: Merge this shuffle with the ReuseShuffleCost. VecLdCost += TTI->getShuffleCost( TargetTransformInfo::SK_PermuteSingleSrc, VecTy); + } LLVM_DEBUG(dumpTreeCosts(E, ReuseShuffleCost, VecLdCost, ScalarLdCost)); return ReuseShuffleCost + VecLdCost - ScalarLdCost; } @@ -3769,14 +3772,18 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { Align Alignment = SI->getAlign(); InstructionCost ScalarEltCost = TTI->getMemoryOpCost( Instruction::Store, ScalarTy, Alignment, 0, CostKind, VL0); + if (NeedToShuffleReuses) +ReuseShuffleCost = -(ReuseShuffleNumbers - VL.size()) * ScalarEltCost; InstructionCost ScalarStCost = VecTy->getNumElements() * ScalarEltCost; InstructionCost VecStCost = TTI->getMemoryOpCost( Instruction::Store, VecTy, Alignment, 0, CostKind, VL0); - if (IsReorder) + if (IsReorder) { +// TODO: Merge this shuffle with the ReuseShuffleCost. VecStCost += TTI->getShuffleCost( TargetTransformInfo::SK_PermuteSingleSrc, VecTy); + } LLVM_DEBUG(dumpTreeCosts(E, ReuseShuffleCost, VecStCost, ScalarStCost)); - return VecStCost - ScalarStCost; + return ReuseShuffleCost + VecStCost - ScalarStCost; } case Instruction::Call: { CallInst *CI = cast(VL0); @@ -4323,64 +4330,6 @@ Value *BoUpSLP::vectorizeTree(ArrayRef VL) { return Vec; } -namespace { -/// Merges shuffle masks and emits final shuffle instruction, if required. -class ShuffleInstructionBuilder { - IRBuilderBase &Builder; - bool IsFinalized = false; - SmallVector Mask; - -public: - ShuffleInstructionBuilder(IRBuilderBase &Builder) : Builder(Builder) {} - - /// Adds a mask, inverting it before applying. - void addInversedMask(ArrayRef SubMask) { -if (SubMask.empty()) - return; -SmallVector NewMask; -inversePermutation(SubMask, NewMask); -addMask(NewMask); - } - - /// Functions adds masks, merging them into single one. - void addMask(ArrayRef SubMask) { -SmallVector NewMask(SubMask.begin(), SubMask.end()); -addMask(NewMask); - } - - void addMask(ArrayRef SubMask) { -if (SubMask.empty()) - return; -if (Mask.empty()) { - Mask.append(SubMask.begin(), SubMask.end()); - return; -} -SmallVector NewMask(SubMask.size(), SubMask.size()); -int TermValue = std::min(Mask.size(),
[llvm-branch-commits] [llvm] d8ffaa9 - [NFC] cleanup noalias2.ll test
Author: Jeroen Dobbelaere Date: 2021-01-19T20:47:02+01:00 New Revision: d8ffaa9f7234d8bf40682763373ab060d14adf22 URL: https://github.com/llvm/llvm-project/commit/d8ffaa9f7234d8bf40682763373ab060d14adf22 DIFF: https://github.com/llvm/llvm-project/commit/d8ffaa9f7234d8bf40682763373ab060d14adf22.diff LOG: [NFC] cleanup noalias2.ll test D75825 and D75828 modified llvm/test/Transforms/Inline/noalias2.ll to handle llvm.assume. The checking though was broken. The NO_ASSUME has been replaced by a normal CHECK; the ASSUME rules were never triggered and have been removed. The test checks have been regenerated. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D94978 Added: Modified: llvm/test/Transforms/Inline/noalias2.ll Removed: diff --git a/llvm/test/Transforms/Inline/noalias2.ll b/llvm/test/Transforms/Inline/noalias2.ll index 59809379c2e5..8732cb538730 100644 --- a/llvm/test/Transforms/Inline/noalias2.ll +++ b/llvm/test/Transforms/Inline/noalias2.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature -; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s --check-prefixes=CHECK,NO_ASSUME +; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s ; RUN: opt -inline -enable-noalias-to-md-conversion --enable-knowledge-retention -S < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -7,19 +7,13 @@ target triple = "x86_64-unknown-linux-gnu" define void @hello(float* noalias nocapture %a, float* noalias nocapture readonly %c) #0 { ; CHECK-LABEL: define {{[^@]+}}@hello -; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture readonly [[C:%.*]]) #0 +; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture readonly [[C:%.*]]) [[ATTR0:#.*]] { ; CHECK-NEXT: entry: ; CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[C]], align 4 ; CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[A]], i64 5 ; CHECK-NEXT:store float [[TMP0]], float* [[ARRAYIDX]], align 4 ; CHECK-NEXT:ret void ; -; ASSUME-LABEL: @hello( -; ASSUME-NEXT: entry: -; ASSUME-NEXT:[[TMP0:%.*]] = load float, float* [[C:%.*]], align 4 -; ASSUME-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 5 -; ASSUME-NEXT:store float [[TMP0]], float* [[ARRAYIDX]], align 4 -; ASSUME-NEXT:ret void entry: %0 = load float, float* %c, align 4 %arrayidx = getelementptr inbounds float, float* %a, i64 5 @@ -29,7 +23,7 @@ entry: define void @foo(float* noalias nocapture %a, float* noalias nocapture readonly %c) #0 { ; CHECK-LABEL: define {{[^@]+}}@foo -; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture readonly [[C:%.*]]) #0 +; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture readonly [[C:%.*]]) [[ATTR0]] { ; CHECK-NEXT: entry: ; CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[C]], align 4, !alias.scope !0, !noalias !3 ; CHECK-NEXT:[[ARRAYIDX_I:%.*]] = getelementptr inbounds float, float* [[A]], i64 5 @@ -39,16 +33,6 @@ define void @foo(float* noalias nocapture %a, float* noalias nocapture readonly ; CHECK-NEXT:store float [[TMP1]], float* [[ARRAYIDX]], align 4 ; CHECK-NEXT:ret void ; -; ASSUME-LABEL: @foo( -; ASSUME-NEXT: entry: -; ASSUME-NEXT:call void @llvm.assume(i1 true) [ "noalias"(float* [[A:%.*]]), "noalias"(float* [[C:%.*]]) ] -; ASSUME-NEXT:[[TMP0:%.*]] = load float, float* [[C]], align 4, !alias.scope !0, !noalias !3 -; ASSUME-NEXT:[[ARRAYIDX_I:%.*]] = getelementptr inbounds float, float* [[A]], i64 5 -; ASSUME-NEXT:store float [[TMP0]], float* [[ARRAYIDX_I]], align 4, !alias.scope !3, !noalias !0 -; ASSUME-NEXT:[[TMP1:%.*]] = load float, float* [[C]], align 4 -; ASSUME-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[A]], i64 7 -; ASSUME-NEXT:store float [[TMP1]], float* [[ARRAYIDX]], align 4 -; ASSUME-NEXT:ret void entry: tail call void @hello(float* %a, float* %c) %0 = load float, float* %c, align 4 @@ -59,7 +43,7 @@ entry: define void @hello2(float* noalias nocapture %a, float* noalias nocapture %b, float* nocapture readonly %c) #0 { ; CHECK-LABEL: define {{[^@]+}}@hello2 -; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture [[B:%.*]], float* nocapture readonly [[C:%.*]]) #0 +; CHECK-SAME: (float* noalias nocapture [[A:%.*]], float* noalias nocapture [[B:%.*]], float* nocapture readonly [[C:%.*]]) [[ATTR0]] { ; CHECK-NEXT: entry: ; CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[C]], align 4 ; CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[A]], i64 6 @@ -81,7
[llvm-branch-commits] [lld] 5b7aef6 - Revert "[PDB] Defer relocating .debug$S until commit time and parallelize it"
Author: Mitch Phillips Date: 2021-01-19T11:45:48-08:00 New Revision: 5b7aef6eb4b2930971029b984cb2360f7682e5a5 URL: https://github.com/llvm/llvm-project/commit/5b7aef6eb4b2930971029b984cb2360f7682e5a5 DIFF: https://github.com/llvm/llvm-project/commit/5b7aef6eb4b2930971029b984cb2360f7682e5a5.diff LOG: Revert "[PDB] Defer relocating .debug$S until commit time and parallelize it" This reverts commit 6529d7c5a45b1b9588e512013b02f891d71bc134. Reason: Broke the ASan buildbots. http://lab.llvm.org:8011/#/builders/99/builds/1567 Added: Modified: lld/COFF/Chunks.cpp lld/COFF/Chunks.h lld/COFF/PDB.cpp llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp Removed: diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index f2cdc24b7bf1..e04ceed505c2 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -369,88 +369,47 @@ void SectionChunk::writeTo(uint8_t *buf) const { continue; } -applyRelocation(buf + rel.VirtualAddress, rel); - } -} +uint8_t *off = buf + rel.VirtualAddress; -void SectionChunk::applyRelocation(uint8_t *off, - const coff_relocation &rel) const { - auto *sym = dyn_cast_or_null(file->getSymbol(rel.SymbolTableIndex)); - - // Get the output section of the symbol for this relocation. The output - // section is needed to compute SECREL and SECTION relocations used in debug - // info. - Chunk *c = sym ? sym->getChunk() : nullptr; - OutputSection *os = c ? c->getOutputSection() : nullptr; +auto *sym = +dyn_cast_or_null(file->getSymbol(rel.SymbolTableIndex)); - // Skip the relocation if it refers to a discarded section, and diagnose it - // as an error if appropriate. If a symbol was discarded early, it may be - // null. If it was discarded late, the output section will be null, unless - // it was an absolute or synthetic symbol. - if (!sym || - (!os && !isa(sym) && !isa(sym))) { -maybeReportRelocationToDiscarded(this, sym, rel); -return; - } +// Get the output section of the symbol for this relocation. The output +// section is needed to compute SECREL and SECTION relocations used in debug +// info. +Chunk *c = sym ? sym->getChunk() : nullptr; +OutputSection *os = c ? c->getOutputSection() : nullptr; + +// Skip the relocation if it refers to a discarded section, and diagnose it +// as an error if appropriate. If a symbol was discarded early, it may be +// null. If it was discarded late, the output section will be null, unless +// it was an absolute or synthetic symbol. +if (!sym || +(!os && !isa(sym) && !isa(sym))) { + maybeReportRelocationToDiscarded(this, sym, rel); + continue; +} - uint64_t s = sym->getRVA(); +uint64_t s = sym->getRVA(); - // Compute the RVA of the relocation for relative relocations. - uint64_t p = rva + rel.VirtualAddress; - switch (config->machine) { - case AMD64: -applyRelX64(off, rel.Type, os, s, p); -break; - case I386: -applyRelX86(off, rel.Type, os, s, p); -break; - case ARMNT: -applyRelARM(off, rel.Type, os, s, p); -break; - case ARM64: -applyRelARM64(off, rel.Type, os, s, p); -break; - default: -llvm_unreachable("unknown machine type"); - } -} - -// Defend against unsorted relocations. This may be overly conservative. -void SectionChunk::sortRelocations() { - auto cmpByVa = [](const coff_relocation &l, const coff_relocation &r) { -return l.VirtualAddress < r.VirtualAddress; - }; - if (llvm::is_sorted(getRelocs(), cmpByVa)) -return; - warn("some relocations in " + file->getName() + " are not sorted"); - MutableArrayRef newRelocs( - bAlloc.Allocate(relocsSize), relocsSize); - memcpy(newRelocs.data(), relocsData, relocsSize * sizeof(coff_relocation)); - llvm::sort(newRelocs, cmpByVa); - setRelocs(newRelocs); -} - -// Similar to writeTo, but suitable for relocating a subsection of the overall -// section. -void SectionChunk::writeAndRelocateSubsection(ArrayRef sec, - ArrayRef subsec, - uint32_t &nextRelocIndex, - uint8_t *buf) const { - assert(!subsec.empty() && !sec.empty()); - assert(sec.begin() <= subsec.begin() && subsec.end() <= sec.end() && - "subsection is not part of this section"); - size_t vaBegin = std::distance(sec.begin(), subsec.begin()); - size_t vaEnd = std::distance(sec.begin(), subsec.end()); - memcpy(buf, subsec.data(), subsec.size()); - for (; nextRelocIndex < relocsSize; ++nextRelocIndex) { -const coff_relocation &rel = relocsData[nextRelocIndex]; -// Skip relocations applied before this subsection. -if (rel.
[llvm-branch-commits] [flang] 24e8e21 - [flang] Refine WhyNotModifiable()
Author: peter klausler Date: 2021-01-19T11:44:51-08:00 New Revision: 24e8e21f19f4380e8410a12f9135bfef3c046142 URL: https://github.com/llvm/llvm-project/commit/24e8e21f19f4380e8410a12f9135bfef3c046142 DIFF: https://github.com/llvm/llvm-project/commit/24e8e21f19f4380e8410a12f9135bfef3c046142.diff LOG: [flang] Refine WhyNotModifiable() The utility routine WhyNotModifiable() needed to become more aware of the use of pointers in data-refs; the targets of pointer components are sometimes modifiable even when the leftmost ("base") symbol of a data-ref is not. Added a new unit test for WhyNotModifiable() that uses internal READ statements (mostly), since I/O semantic checking uses WhyNotModifiable() for all its definability checking. Differential Revision: https://reviews.llvm.org/D94849 Added: flang/test/Semantics/modifiable01.f90 Modified: flang/include/flang/Evaluate/tools.h flang/lib/Evaluate/tools.cpp flang/lib/Semantics/check-io.cpp flang/lib/Semantics/tools.cpp Removed: diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h index 69eab61f25b2..3fe3dc1843ec 100644 --- a/flang/include/flang/Evaluate/tools.h +++ b/flang/include/flang/Evaluate/tools.h @@ -336,6 +336,9 @@ template const Symbol *GetFirstSymbol(const A &x) { } } +// GetLastPointerSymbol(A%PTR1%B%PTR2%C) -> PTR2 +const Symbol *GetLastPointerSymbol(const evaluate::DataRef &); + // Creation of conversion expressions can be done to either a known // specific intrinsic type with ConvertToType(x) or by converting // one arbitrary expression to the type of another with ConvertTo(to, from). diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp index b1c01d4f4711..2b04ed8a6550 100644 --- a/flang/lib/Evaluate/tools.cpp +++ b/flang/lib/Evaluate/tools.cpp @@ -896,6 +896,31 @@ std::optional CheckProcCompatibility(bool isCall, return msg; } +// GetLastPointerSymbol() +static const Symbol *GetLastPointerSymbol(const Symbol &symbol) { + return IsPointer(GetAssociationRoot(symbol)) ? &symbol : nullptr; +} +static const Symbol *GetLastPointerSymbol(const SymbolRef &symbol) { + return GetLastPointerSymbol(*symbol); +} +static const Symbol *GetLastPointerSymbol(const Component &x) { + const Symbol &c{x.GetLastSymbol()}; + return IsPointer(c) ? &c : GetLastPointerSymbol(x.base()); +} +static const Symbol *GetLastPointerSymbol(const NamedEntity &x) { + const auto *c{x.UnwrapComponent()}; + return c ? GetLastPointerSymbol(*c) : GetLastPointerSymbol(x.GetLastSymbol()); +} +static const Symbol *GetLastPointerSymbol(const ArrayRef &x) { + return GetLastPointerSymbol(x.base()); +} +static const Symbol *GetLastPointerSymbol(const CoarrayRef &x) { + return nullptr; +} +const Symbol *GetLastPointerSymbol(const DataRef &x) { + return std::visit([](const auto &y) { return GetLastPointerSymbol(y); }, x.u); +} + } // namespace Fortran::evaluate namespace Fortran::semantics { diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp index 9095951389f2..de19ed4d6d40 100644 --- a/flang/lib/Semantics/check-io.cpp +++ b/flang/lib/Semantics/check-io.cpp @@ -928,9 +928,12 @@ void IoChecker::CheckForDefinableVariable( const A &var, const std::string &s) const { const Symbol *sym{ GetFirstName(*parser::Unwrap(var)).symbol}; - if (WhyNotModifiable(*sym, context_.FindScope(*context_.location( { -context_.Say(parser::FindSourceLocation(var), -"%s variable '%s' must be definable"_err_en_US, s, sym->name()); + if (auto whyNot{ + WhyNotModifiable(*sym, context_.FindScope(*context_.location()))}) { +auto at{parser::FindSourceLocation(var)}; +context_ +.Say(at, "%s variable '%s' must be definable"_err_en_US, s, sym->name()) +.Attach(at, std::move(*whyNot), sym->name()); } } diff --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp index 1bc008610bf0..f7d3c20de2a0 100644 --- a/flang/lib/Semantics/tools.cpp +++ b/flang/lib/Semantics/tools.cpp @@ -776,27 +776,62 @@ bool InProtectedContext(const Symbol &symbol, const Scope ¤tScope) { } // C1101 and C1158 -std::optional WhyNotModifiable( -const Symbol &original, const Scope &scope) { - const Symbol &symbol{GetAssociationRoot(original)}; +// Modifiability checks on the leftmost symbol ("base object") +// of a data-ref +std::optional WhyNotModifiableFirst( +const Symbol &symbol, const Scope &scope) { if (symbol.has()) { return "'%s' is construct associated with an expression"_en_US; - } else if (InProtectedContext(symbol, scope)) { -return "'%s' is protected in this scope"_en_US; } else if (IsExternalInPureContext(symbol, scope)) { return "'%s' is externally visible and referenced in a pure" " procedure"_en_US; - } else if (IsOrContainsEventOrLockComponent(symbol)) { + } else if (!I
[llvm-branch-commits] [lld] e12e0d6 - [ELF] Error for out-of-range R_PPC64_ADDR16_HA, R_PPC64_ADDR16_HI and their friends
Author: Fangrui Song Date: 2021-01-19T11:42:52-08:00 New Revision: e12e0d66c03c89d8ff0b08a4285f5b74a85a5812 URL: https://github.com/llvm/llvm-project/commit/e12e0d66c03c89d8ff0b08a4285f5b74a85a5812 DIFF: https://github.com/llvm/llvm-project/commit/e12e0d66c03c89d8ff0b08a4285f5b74a85a5812.diff LOG: [ELF] Error for out-of-range R_PPC64_ADDR16_HA, R_PPC64_ADDR16_HI and their friends There are no tests for REL16_* and TPREL16_*. Added: lld/test/ELF/ppc64-reloc-addr16-err.s Modified: lld/ELF/Arch/PPC64.cpp Removed: diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index 477f76bd31b7..ebd94f6690da 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -407,7 +407,7 @@ class PPC64 final : public TargetInfo { // document. static uint16_t lo(uint64_t v) { return v; } static uint16_t hi(uint64_t v) { return v >> 16; } -static uint16_t ha(uint64_t v) { return (v + 0x8000) >> 16; } +static uint64_t ha(uint64_t v) { return (v + 0x8000) >> 16; } static uint16_t higher(uint64_t v) { return v >> 32; } static uint16_t highera(uint64_t v) { return (v + 0x8000) >> 32; } static uint16_t highest(uint64_t v) { return v >> 48; } @@ -1219,12 +1219,15 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { case R_PPC64_TPREL16_HA: if (config->tocOptimize && shouldTocOptimize && ha(val) == 0) writeFromHalf16(loc, NOP); -else +else { + checkInt(loc, val + 0x8000, 32, rel); write16(loc, ha(val)); +} break; case R_PPC64_ADDR16_HI: case R_PPC64_REL16_HI: case R_PPC64_TPREL16_HI: +checkInt(loc, val, 32, rel); write16(loc, hi(val)); break; case R_PPC64_ADDR16_HIGHER: diff --git a/lld/test/ELF/ppc64-reloc-addr16-err.s b/lld/test/ELF/ppc64-reloc-addr16-err.s new file mode 100644 index ..1b221d5436cc --- /dev/null +++ b/lld/test/ELF/ppc64-reloc-addr16-err.s @@ -0,0 +1,20 @@ +# REQUIRES: ppc +# RUN: llvm-mc -filetype=obj -triple=ppc64le --defsym HI=1 %s -o %thi.o +# RUN: ld.lld %thi.o --defsym=a=0x7fff -o /dev/null +# RUN: not ld.lld %thi.o --defsym=a=0x8000 -o /dev/null +# RUN: ld.lld %thi.o --defsym=a=0x8000 -o /dev/null +# RUN: not ld.lld %thi.o --defsym=a=0x7fff -o /dev/null + +# RUN: llvm-mc -filetype=obj -triple=ppc64le --defsym HA=1 %s -o %tha.o +# RUN: ld.lld %tha.o --defsym=a=0x7fff7fff -o /dev/null +# RUN: not ld.lld %tha.o --defsym=a=0x7fff8000 -o /dev/null +# RUN: ld.lld %tha.o --defsym=a=0x7fff8000 -o /dev/null +# RUN: not ld.lld %tha.o --defsym=a=0x7fff7fff -o /dev/null + +.ifdef HI +lis 4, a@h # R_PPC64_ADDR16_HI +.endif + +.ifdef HA +lis 4, a@ha # R_PPC64_ADDR16_HA +.endif ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 5fcb412 - [ELF] Support R_PPC64_ADDR16_HIGH
Author: Fangrui Song Date: 2021-01-19T11:42:53-08:00 New Revision: 5fcb412ed0831ad763810f9b424149b3b353451a URL: https://github.com/llvm/llvm-project/commit/5fcb412ed0831ad763810f9b424149b3b353451a DIFF: https://github.com/llvm/llvm-project/commit/5fcb412ed0831ad763810f9b424149b3b353451a.diff LOG: [ELF] Support R_PPC64_ADDR16_HIGH R_PPC64_ADDR16_HI represents bits 16-31 of a 32-bit value R_PPC64_ADDR16_HIGH represents bits 16-31 of a 64-bit value. In the Linux kernel, `LOAD_REG_IMMEDIATE_SYM` defined in `arch/powerpc/include/asm/ppc_asm.h` uses @l, @high, @higher, @highest to load the 64-bit value of a symbol. Fixes https://github.com/ClangBuiltLinux/linux/issues/1260 Added: Modified: lld/ELF/Arch/PPC64.cpp lld/test/ELF/ppc64-reloc-addr.s lld/test/ELF/ppc64-reloc-addr16-err.s Removed: diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index ebd94f6690da..03ecc811b2cf 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -948,6 +948,7 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &s, case R_PPC64_ADDR16_DS: case R_PPC64_ADDR16_HA: case R_PPC64_ADDR16_HI: + case R_PPC64_ADDR16_HIGH: case R_PPC64_ADDR16_HIGHER: case R_PPC64_ADDR16_HIGHERA: case R_PPC64_ADDR16_HIGHEST: @@ -1230,6 +1231,9 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { checkInt(loc, val, 32, rel); write16(loc, hi(val)); break; + case R_PPC64_ADDR16_HIGH: +write16(loc, hi(val)); +break; case R_PPC64_ADDR16_HIGHER: case R_PPC64_TPREL16_HIGHER: write16(loc, higher(val)); diff --git a/lld/test/ELF/ppc64-reloc-addr.s b/lld/test/ELF/ppc64-reloc-addr.s index 7eb13c2ef5bc..d7b0a3dc7c0f 100644 --- a/lld/test/ELF/ppc64-reloc-addr.s +++ b/lld/test/ELF/ppc64-reloc-addr.s @@ -25,6 +25,11 @@ .section .R_PPC64_ADDR16_HA,"ax",@progbits lis 4, b@ha +# CHECK-LABEL: <.R_PPC64_ADDR16_HIGH>: +# CHECK-NEXT:lis 4, -30293 +.section .R_PPC64_ADDR16_HIGH,"ax",@progbits + lis 4, a@high + # CHECK-LABEL: <.R_PPC64_ADDR16_HIGHER>: # CHECK-NEXT:li 3, 17767 .section .R_PPC64_ADDR16_HIGHER,"ax",@progbits diff --git a/lld/test/ELF/ppc64-reloc-addr16-err.s b/lld/test/ELF/ppc64-reloc-addr16-err.s index 1b221d5436cc..fe225b5013da 100644 --- a/lld/test/ELF/ppc64-reloc-addr16-err.s +++ b/lld/test/ELF/ppc64-reloc-addr16-err.s @@ -18,3 +18,5 @@ lis 4, a@h # R_PPC64_ADDR16_HI .ifdef HA lis 4, a@ha # R_PPC64_ADDR16_HA .endif + +lis 4, a@high # R_PPC64_ADDR16_HIGH ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] d39adea - [ELF] Improve R_PPC64_ADDR* relocation tests
Author: Fangrui Song Date: 2021-01-19T11:42:51-08:00 New Revision: d39adeaf440bc0db508b7d2a4eb9ace7f40178fc URL: https://github.com/llvm/llvm-project/commit/d39adeaf440bc0db508b7d2a4eb9ace7f40178fc DIFF: https://github.com/llvm/llvm-project/commit/d39adeaf440bc0db508b7d2a4eb9ace7f40178fc.diff LOG: [ELF] Improve R_PPC64_ADDR* relocation tests Added: lld/test/ELF/ppc64-reloc-addr-err.s Modified: lld/test/ELF/ppc64-reloc-addr.s lld/test/ELF/ppc64-relocs.s Removed: diff --git a/lld/test/ELF/ppc64-reloc-addr-err.s b/lld/test/ELF/ppc64-reloc-addr-err.s new file mode 100644 index ..ef423a1c2e2b --- /dev/null +++ b/lld/test/ELF/ppc64-reloc-addr-err.s @@ -0,0 +1,25 @@ +# REQUIRES: ppc +# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs255.s -o %t255.o +# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs256.s -o %t256.o +# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs257.s -o %t257.o + +# RUN: ld.lld %t.o %t256.o -o %t +# RUN: llvm-readelf -x .data %t | FileCheck %s +# CHECK: 0x{{[0-9a-f]+}} 0080 0080 + +# RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW1 %s +# OVERFLOW1: relocation R_PPC64_ADDR16 out of range: -32769 is not in [-32768, 65535]; references foo +# OVERFLOW1: relocation R_PPC64_ADDR32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo + +# RUN: not ld.lld %t.o %t257.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW2 %s +# OVERFLOW2: relocation R_PPC64_ADDR16 out of range: 65536 is not in [-32768, 65535]; references foo +# OVERFLOW2: relocation R_PPC64_ADDR32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo + +.globl _start +_start: +.data +.word foo + 0xfeff +.word foo - 0x8100 +.long foo + 0xfeff +.long foo - 0x8100 diff --git a/lld/test/ELF/ppc64-reloc-addr.s b/lld/test/ELF/ppc64-reloc-addr.s index ef423a1c2e2b..7eb13c2ef5bc 100644 --- a/lld/test/ELF/ppc64-reloc-addr.s +++ b/lld/test/ELF/ppc64-reloc-addr.s @@ -1,25 +1,46 @@ # REQUIRES: ppc -# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o -# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs255.s -o %t255.o -# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs256.s -o %t256.o -# RUN: llvm-mc -filetype=obj -triple=powerpc64le %S/Inputs/abs257.s -o %t257.o - -# RUN: ld.lld %t.o %t256.o -o %t -# RUN: llvm-readelf -x .data %t | FileCheck %s -# CHECK: 0x{{[0-9a-f]+}} 0080 0080 - -# RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW1 %s -# OVERFLOW1: relocation R_PPC64_ADDR16 out of range: -32769 is not in [-32768, 65535]; references foo -# OVERFLOW1: relocation R_PPC64_ADDR32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo - -# RUN: not ld.lld %t.o %t257.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW2 %s -# OVERFLOW2: relocation R_PPC64_ADDR16 out of range: 65536 is not in [-32768, 65535]; references foo -# OVERFLOW2: relocation R_PPC64_ADDR32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo - -.globl _start -_start: -.data -.word foo + 0xfeff -.word foo - 0x8100 -.long foo + 0xfeff -.long foo - 0x8100 +# RUN: llvm-mc -filetype=obj -triple=ppc64le %s -o %t.o +# RUN: ld.lld %t.o --defsym=a=0x0123456789abcdef --defsym=b=0x76543210 -o %t +# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s +# RUN: llvm-objdump -s --no-show-raw-insn %t | FileCheck --check-prefixes=HEX,HEXLE %s + +# HEX-LABEL: section .R_PPC64_ADDR32: +# HEXLE-NEXT: 10325476 +# HEXBE-NEXT: 76543210 +.section .R_PPC64_ADDR32,"a",@progbits + .long b + +# CHECK-LABEL: <.R_PPC64_ADDR16_LO>: +# CHECK-NEXT:addi 4, 4, 12816 +.section .R_PPC64_ADDR16_LO,"ax",@progbits + addi 4, 4, b@l + +# CHECK-LABEL: <.R_PPC64_ADDR16_HI>: +# CHECK-NEXT:lis 4, 30292 +.section .R_PPC64_ADDR16_HI,"ax",@progbits + lis 4, b@h + +# CHECK-LABEL: <.R_PPC64_ADDR16_HA>: +# CHECK-NEXT:lis 4, 30292 +.section .R_PPC64_ADDR16_HA,"ax",@progbits + lis 4, b@ha + +# CHECK-LABEL: <.R_PPC64_ADDR16_HIGHER>: +# CHECK-NEXT:li 3, 17767 +.section .R_PPC64_ADDR16_HIGHER,"ax",@progbits + li 3, a@higher + +# CHECK-LABEL: <.R_PPC64_ADDR16_HIGHERA>: +# CHECK-NEXT:li 3, 17767 +.section .R_PPC64_ADDR16_HIGHERA,"ax",@progbits + li 3, a@highera + +# CHECK-LABEL: <.R_PPC64_ADDR16_HIGHEST>: +# CHECK-NEXT:li 3, 291 +.section .R_PPC64_ADDR16_HIGHEST,"ax",@progbits + li 3, a@highest + +# CHECK-LABEL: <.R_PPC64_ADDR16_HIGHESTA>: +# CHECK-NEXT:li 3, 291 +.section .R_PPC64_ADDR16_HIGHESTA,"ax",@progbits + li 3, a@highesta diff --git a/lld/test/ELF/ppc64-relocs.s b/lld/test/ELF/ppc64-relocs.s index e3363b60488f..0b0be487521e 100644 --- a/lld/test/ELF/ppc64-relocs.s +++ b/lld/test/ELF/ppc64-relocs.s @@ -
[llvm-branch-commits] [llvm] a4b42c6 - [llvm] Protect signpost map with a mutex
Author: Jonas Devlieghere Date: 2021-01-19T11:41:54-08:00 New Revision: a4b42c621b9e2009cfd8bc9265bbf970c7231271 URL: https://github.com/llvm/llvm-project/commit/a4b42c621b9e2009cfd8bc9265bbf970c7231271 DIFF: https://github.com/llvm/llvm-project/commit/a4b42c621b9e2009cfd8bc9265bbf970c7231271.diff LOG: [llvm] Protect signpost map with a mutex Use a mutex to protect concurrent access to the signpost map. This fixes nondeterministic crashes in LLDB that appeared after using signposts in the timer implementation. Differential revision: https://reviews.llvm.org/D94285 Added: Modified: llvm/lib/Support/Signposts.cpp Removed: diff --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp index 91ce909c7dcb..9353e9b294d1 100644 --- a/llvm/lib/Support/Signposts.cpp +++ b/llvm/lib/Support/Signposts.cpp @@ -13,6 +13,7 @@ #include "llvm/Config/config.h" #if LLVM_SUPPORT_XCODE_SIGNPOSTS #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/Mutex.h" #include #endif // if LLVM_SUPPORT_XCODE_SIGNPOSTS @@ -38,9 +39,11 @@ class SignpostEmitterImpl { LogPtrTy SignpostLog; DenseMap Signposts; + sys::SmartMutex Mutex; LogTy &getLogger() const { return *SignpostLog; } os_signpost_id_t getSignpostForObject(const void *O) { +sys::SmartScopedLock Lock(Mutex); const auto &I = Signposts.find(O); if (I != Signposts.end()) return I->second; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] 6ac9cb2 - [libc++][P1679] add string contains
Author: Wim Leflere Date: 2021-01-19T14:35:07-05:00 New Revision: 6ac9cb2a7c6c19797fc778f3d441a6fb7b69793c URL: https://github.com/llvm/llvm-project/commit/6ac9cb2a7c6c19797fc778f3d441a6fb7b69793c DIFF: https://github.com/llvm/llvm-project/commit/6ac9cb2a7c6c19797fc778f3d441a6fb7b69793c.diff LOG: [libc++][P1679] add string contains C++23 string contains implementation and tests Paper: https://wg21.link/P1679R3 Standard (string): https://eel.is/c++draft/string.contains Standard (string_view): https://eel.is/c++draft/string.view.ops#lib:contains,basic_string_view Differential Revision: https://reviews.llvm.org/D93912 Added: libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp libcxx/test/std/strings/string.view/string.view.template/contains.char.pass.cpp libcxx/test/std/strings/string.view/string.view.template/contains.ptr.pass.cpp libcxx/test/std/strings/string.view/string.view.template/contains.string_view.pass.cpp Modified: libcxx/docs/FeatureTestMacroTable.rst libcxx/include/string libcxx/include/string_view libcxx/include/version libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp libcxx/utils/generate_feature_test_macro_components.py Removed: diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index 8221bbe2a4af..b5db1e08d7bf 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -298,6 +298,6 @@ Status - - ``__cpp_lib_stdatomic_h`` *unimplemented* - - -``__cpp_lib_string_contains`` *unimplemented* +``__cpp_lib_string_contains`` ``202011L`` = = diff --git a/libcxx/include/string b/libcxx/include/string index ef606665e22c..687795c79bb9 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -324,6 +324,10 @@ public: bool ends_with(charT c) const noexcept; // C++20 bool ends_with(const charT* s) const; // C++20 +constexpr bool contains(basic_string_view sv) const noexcept; // C++2b +constexpr bool contains(charT c) const noexcept; // C++2b +constexpr bool contains(const charT* s) const; // C++2b + bool __invariants() const; }; @@ -1433,6 +1437,20 @@ public: { return ends_with(__self_view(__s)); } #endif +#if _LIBCPP_STD_VER > 20 +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(__self_view __sv) const noexcept +{ return __self_view(data(), size()).contains(__sv); } + +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(value_type __c) const noexcept +{ return __self_view(data(), size()).contains(__c); } + +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(const value_type* __s) const +{ return __self_view(data(), size()).contains(__s); } +#endif + _LIBCPP_INLINE_VISIBILITY bool __invariants() const; _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT; diff --git a/libcxx/include/string_view b/libcxx/include/string_view index 28bbd3690e2a..bc0245cf2b5e 100644 --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -149,6 +149,10 @@ namespace std { constexpr bool ends_with(charT c) const noexcept; // C++20 constexpr bool ends_with(const charT* s) const; // C++20 + constexpr bool contains(basic_string_view s) const noexcept; // C++2b + constexpr bool contains(charT c) const noexcept; // C++2b + constexpr bool contains(const charT* s) const; // C++2b + private: const_pointer data_; // exposition only size_type size_; // exposition only @@ -622,6 +626,20 @@ public: { return ends_with(basic_string_view(__s)); } #endif +#if _LIBCPP_STD_VER > 20 +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(basic_string_view __sv) const noexcept +{ return find(__sv) != npos; } + +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(value_type __c) const noexcept +{ return find(__c) != npos; } + +constexpr _LIBCPP_INLINE_VISIBILITY +bool contains(const value_type* __s) const +{ return fi
[llvm-branch-commits] [llvm] 7113de3 - [ScalarizeMaskedMemIntrin] Add missing dependency
Author: Mariya Podchishchaeva Date: 2021-01-19T22:33:47+03:00 New Revision: 7113de301a846521a2bdd73d44ac9cf5827b37a6 URL: https://github.com/llvm/llvm-project/commit/7113de301a846521a2bdd73d44ac9cf5827b37a6 DIFF: https://github.com/llvm/llvm-project/commit/7113de301a846521a2bdd73d44ac9cf5827b37a6.diff LOG: [ScalarizeMaskedMemIntrin] Add missing dependency The pass has dependency on 'TargetTransformInfoWrapperPass', but the corresponding call to INITIALIZE_PASS_DEPENDENCY was missing. Differential Revision: https://reviews.llvm.org/D94916 Added: Modified: llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp Removed: diff --git a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp index 725e15f8b06e..afa2d1bc7966 100644 --- a/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp @@ -72,8 +72,13 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT, char ScalarizeMaskedMemIntrinLegacyPass::ID = 0; -INITIALIZE_PASS(ScalarizeMaskedMemIntrinLegacyPass, DEBUG_TYPE, -"Scalarize unsupported masked memory intrinsics", false, false) +INITIALIZE_PASS_BEGIN(ScalarizeMaskedMemIntrinLegacyPass, DEBUG_TYPE, + "Scalarize unsupported masked memory intrinsics", false, + false) +INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) +INITIALIZE_PASS_END(ScalarizeMaskedMemIntrinLegacyPass, DEBUG_TYPE, +"Scalarize unsupported masked memory intrinsics", false, +false) FunctionPass *llvm::createScalarizeMaskedMemIntrinLegacyPass() { return new ScalarizeMaskedMemIntrinLegacyPass(); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 2144338 - Reapply [InstCombine] Replace one-use select operand based on condition
Author: Nikita Popov Date: 2021-01-19T20:26:38+01:00 New Revision: 21443381c00d9d5ddd6a73f2f839dc4872d79463 URL: https://github.com/llvm/llvm-project/commit/21443381c00d9d5ddd6a73f2f839dc4872d79463 DIFF: https://github.com/llvm/llvm-project/commit/21443381c00d9d5ddd6a73f2f839dc4872d79463.diff LOG: Reapply [InstCombine] Replace one-use select operand based on condition Relative to the original change, this adds a check that the instruction on which we're replacing operands is safe to speculatively execute, because that's what we're effectively doing. We're executing the instruction with the replaced operand, which is fine if it's pure, but not fine if can cause side-effects or UB (aka is not speculatable). Additionally, we cannot (generally) replace operands in phi nodes, as these may refer to a different loop iteration. This is also covered by the speculation check. - InstCombine already performs a fold where X == Y ? f(X) : Z is transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However, if f(X) only has one use, then we can always directly replace the use inside the instruction. To actually be profitable, limit it to the case where Y is a non-expr constant. This could be further extended to replace uses further up a one-use instruction chain, but for now this only looks one level up. Among other things, this also subsumes D94860. Differential Revision: https://reviews.llvm.org/D94862 Added: Modified: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp llvm/test/Transforms/InstCombine/select-binop-cmp.ll llvm/test/Transforms/InstCombine/select-safe-transforms.ll Removed: diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 5a43b8b20db9..f26c194d31b9 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -1113,10 +1113,27 @@ Instruction *InstCombinerImpl::foldSelectValueEquivalence(SelectInst &Sel, // replacement cycle. Value *CmpLHS = Cmp.getOperand(0), *CmpRHS = Cmp.getOperand(1); if (TrueVal != CmpLHS && - isGuaranteedNotToBeUndefOrPoison(CmpRHS, SQ.AC, &Sel, &DT)) + isGuaranteedNotToBeUndefOrPoison(CmpRHS, SQ.AC, &Sel, &DT)) { if (Value *V = SimplifyWithOpReplaced(TrueVal, CmpLHS, CmpRHS, SQ, /* AllowRefinement */ true)) return replaceOperand(Sel, Swapped ? 2 : 1, V); + +// Even if TrueVal does not simplify, we can directly replace a use of +// CmpLHS with CmpRHS, as long as the instruction is not used anywhere +// else and is safe to speculatively execute (we may end up executing it +// with diff erent operands, which should not cause side-effects or trigger +// undefined behavior). Only do this if CmpRHS is a constant, as +// profitability is not clear for other cases. +// FIXME: The replacement could be performed recursively. +if (match(CmpRHS, m_ImmConstant()) && !match(CmpLHS, m_ImmConstant())) + if (auto *I = dyn_cast(TrueVal)) +if (I->hasOneUse() && isSafeToSpeculativelyExecute(I)) + for (Use &U : I->operands()) +if (U == CmpLHS) { + replaceUse(U, CmpRHS); + return &Sel; +} + } if (TrueVal != CmpRHS && isGuaranteedNotToBeUndefOrPoison(CmpLHS, SQ.AC, &Sel, &DT)) if (Value *V = SimplifyWithOpReplaced(TrueVal, CmpRHS, CmpLHS, SQ, diff --git a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll index 99670c4cc1d3..bbf7456ae811 100644 --- a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll @@ -502,7 +502,7 @@ define i32 @select_xor_icmp_bad_2(i32 %x, i32 %y, i32 %z, i32 %k) { define i32 @select_xor_icmp_bad_3(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @select_xor_icmp_bad_3( ; CHECK-NEXT:[[A:%.*]] = icmp eq i32 [[X:%.*]], 3 -; CHECK-NEXT:[[B:%.*]] = xor i32 [[X]], [[Z:%.*]] +; CHECK-NEXT:[[B:%.*]] = xor i32 [[Z:%.*]], 3 ; CHECK-NEXT:[[C:%.*]] = select i1 [[A]], i32 [[B]], i32 [[Y:%.*]] ; CHECK-NEXT:ret i32 [[C]] ; @@ -541,7 +541,7 @@ define i32 @select_xor_icmp_bad_5(i32 %x, i32 %y, i32 %z) { define i32 @select_xor_icmp_bad_6(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @select_xor_icmp_bad_6( ; CHECK-NEXT:[[A_NOT:%.*]] = icmp eq i32 [[X:%.*]], 1 -; CHECK-NEXT:[[B:%.*]] = xor i32 [[X]], [[Z:%.*]] +; CHECK-NEXT:[[B:%.*]] = xor i32 [[Z:%.*]], 1 ; CHECK-NEXT:[[C:%.*]] = select i1 [[A_NOT]], i32 [[B]], i32 [[Y:%.*]] ; CHECK-NEXT:ret i32 [[C]] ; @@ -554,7 +554,7 @@ define i32 @select_xor_icmp_bad_6(i32 %x, i32 %y, i32 %z) { define <2 x i8> @select_xor_icmp_vec_bad(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z) { ; CHECK-LABEL: @select_xor_icmp_vec_bad( ; CHECK-NEXT:[[A:
[llvm-branch-commits] [llvm] bedbb58 - [InstCombine] Add additional tests for select operand replacement (NFC)
Author: Nikita Popov Date: 2021-01-19T20:26:38+01:00 New Revision: bedbb58203cd67a46f64a0182dc1e6717b3c536c URL: https://github.com/llvm/llvm-project/commit/bedbb58203cd67a46f64a0182dc1e6717b3c536c DIFF: https://github.com/llvm/llvm-project/commit/bedbb58203cd67a46f64a0182dc1e6717b3c536c.diff LOG: [InstCombine] Add additional tests for select operand replacement (NFC) In particular, add tests for speculatable and non-speculatable instructions. Added: Modified: llvm/test/Transforms/InstCombine/select-binop-cmp.ll Removed: diff --git a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll index 55738953f60d..99670c4cc1d3 100644 --- a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll @@ -1125,19 +1125,6 @@ define i32 @select_replace_fold(i32 %x, i32 %y, i32 %z) { ret i32 %s } -define i32 @select_replace_multiple_ops(i32 %x, i32 %y) { -; CHECK-LABEL: @select_replace_multiple_ops( -; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 0 -; CHECK-NEXT:[[CALL:%.*]] = call i32 @dummy_call(i32 [[X]], i32 [[X]], i32 [[X]]) -; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[CALL]], i32 [[Y:%.*]] -; CHECK-NEXT:ret i32 [[S]] -; - %c = icmp eq i32 %x, 0 - %call = call i32 @dummy_call(i32 %x, i32 %x, i32 %x) - %s = select i1 %c, i32 %call, i32 %y - ret i32 %s -} - define i32 @select_replace_nested(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @select_replace_nested( ; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 0 @@ -1179,9 +1166,113 @@ define <2 x i32> @select_replace_undef(<2 x i32> %x, <2 x i32> %y) { ret <2 x i32> %s } +define i32 @select_replace_call_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_call_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 0 +; CHECK-NEXT:[[CALL:%.*]] = call i32 @call_speculatable(i32 [[X]], i32 [[X]]) +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[CALL]], i32 [[Y:%.*]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, 0 + %call = call i32 @call_speculatable(i32 %x, i32 %x) + %s = select i1 %c, i32 %call, i32 %y + ret i32 %s +} + +define i32 @select_replace_call_non_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_call_non_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 0 +; CHECK-NEXT:[[CALL:%.*]] = call i32 @call_non_speculatable(i32 [[X]], i32 [[X]]) +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[CALL]], i32 [[Y:%.*]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, 0 + %call = call i32 @call_non_speculatable(i32 %x, i32 %x) + %s = select i1 %c, i32 %call, i32 %y + ret i32 %s +} + +define i32 @select_replace_sdiv_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_sdiv_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 2 +; CHECK-NEXT:[[DIV:%.*]] = sdiv i32 [[Y:%.*]], [[X]] +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[DIV]], i32 [[Y]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, 2 + %div = sdiv i32 %y, %x + %s = select i1 %c, i32 %div, i32 %y + ret i32 %s +} + +define i32 @select_replace_sdiv_non_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_sdiv_non_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], -1 +; CHECK-NEXT:[[DIV:%.*]] = sdiv i32 [[Y:%.*]], [[X]] +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[DIV]], i32 [[Y]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, -1 + %div = sdiv i32 %y, %x + %s = select i1 %c, i32 %div, i32 %y + ret i32 %s +} + +define i32 @select_replace_udiv_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_udiv_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 2 +; CHECK-NEXT:[[DIV:%.*]] = udiv i32 [[Y:%.*]], [[X]] +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 [[DIV]], i32 [[Y]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, 2 + %div = udiv i32 %y, %x + %s = select i1 %c, i32 %div, i32 %y + ret i32 %s +} + +define i32 @select_replace_udiv_non_speculatable(i32 %x, i32 %y) { +; CHECK-LABEL: @select_replace_udiv_non_speculatable( +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[X:%.*]], 0 +; CHECK-NEXT:[[S:%.*]] = select i1 [[C]], i32 poison, i32 [[Y:%.*]] +; CHECK-NEXT:ret i32 [[S]] +; + %c = icmp eq i32 %x, 0 + %div = udiv i32 %y, %x + %s = select i1 %c, i32 %div, i32 %y + ret i32 %s +} + +define void @select_replace_phi(i32 %x) { +; CHECK-LABEL: @select_replace_phi( +; CHECK-NEXT: entry: +; CHECK-NEXT:br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT:[[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] +; CHECK-NEXT:[[I_PREV:%.*]] = phi i32 [ -1, [[ENTRY]] ], [ [[I]], [[LOOP]] ] +; CHECK-NEXT:[[I_NEXT]] = add i32 [[I]], 1 +; CHECK-NEXT:[[C:%.*]] = icmp eq i32 [[I]], 0 +; CHECK-NEX
[llvm-branch-commits] [lld] a231786 - [wasm][LLD] Rename --lto-new-pass-manager to --no-lto-legacy-pass-manager
Author: Arthur Eubanks Date: 2021-01-19T11:22:40-08:00 New Revision: a23178690987f04a09125d712ec3168b084539bb URL: https://github.com/llvm/llvm-project/commit/a23178690987f04a09125d712ec3168b084539bb DIFF: https://github.com/llvm/llvm-project/commit/a23178690987f04a09125d712ec3168b084539bb.diff LOG: [wasm][LLD] Rename --lto-new-pass-manager to --no-lto-legacy-pass-manager This follows a similar ELF change. Reviewed By: MaskRay, sbc100 Differential Revision: https://reviews.llvm.org/D93253 Added: Modified: lld/test/wasm/lto/new-pass-manager.ll lld/test/wasm/lto/verify-invalid.ll lld/wasm/Driver.cpp lld/wasm/Options.td Removed: diff --git a/lld/test/wasm/lto/new-pass-manager.ll b/lld/test/wasm/lto/new-pass-manager.ll index 48829de8d378..5fc75f5bb3f2 100644 --- a/lld/test/wasm/lto/new-pass-manager.ll +++ b/lld/test/wasm/lto/new-pass-manager.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as -o %t.bc %s -; RUN: wasm-ld --lto-new-pass-manager --lto-debug-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s -; RUN: wasm-ld --lto-new-pass-manager --lto-debug-pass-manager --no-lto-new-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s --allow-empty --check-prefix=LPM +; RUN: wasm-ld --no-lto-legacy-pass-manager --lto-debug-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s +; RUN: wasm-ld --no-lto-legacy-pass-manager --lto-debug-pass-manager --lto-legacy-pass-manager -o /dev/null %t.bc 2>&1 | FileCheck %s --allow-empty --check-prefix=LPM ; CHECK: Starting llvm::Module pass manager run ; CHECK: Finished llvm::Module pass manager run diff --git a/lld/test/wasm/lto/verify-invalid.ll b/lld/test/wasm/lto/verify-invalid.ll index 5e6daac85888..4cc8c6128640 100644 --- a/lld/test/wasm/lto/verify-invalid.ll +++ b/lld/test/wasm/lto/verify-invalid.ll @@ -1,11 +1,11 @@ ; RUN: llvm-as %s -o %t.o -; RUN: wasm-ld %t.o -o %t2 --no-lto-new-pass-manager -mllvm -debug-pass=Arguments \ +; RUN: wasm-ld %t.o -o %t2 --lto-legacy-pass-manager -mllvm -debug-pass=Arguments \ ; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-LPM %s -; RUN: wasm-ld %t.o -o %t2 --no-lto-new-pass-manager -mllvm -debug-pass=Arguments \ +; RUN: wasm-ld %t.o -o %t2 --lto-legacy-pass-manager -mllvm -debug-pass=Arguments \ ; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-LPM %s -; RUN: wasm-ld %t.o -o %t2 --lto-new-pass-manager --lto-debug-pass-manager \ +; RUN: wasm-ld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \ ; RUN: 2>&1 | FileCheck -check-prefix=DEFAULT-NPM %s -; RUN: wasm-ld %t.o -o %t2 --lto-new-pass-manager --lto-debug-pass-manager \ +; RUN: wasm-ld %t.o -o %t2 --no-lto-legacy-pass-manager --lto-debug-pass-manager \ ; RUN: -disable-verify 2>&1 | FileCheck -check-prefix=DISABLE-NPM %s target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index d349a6abf5e6..b988f9fa7fd1 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -382,7 +382,7 @@ static void readConfigs(opt::InputArgList &args) { config->ltoo = args::getInteger(args, OPT_lto_O, 2); config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1); config->ltoNewPassManager = - args.hasFlag(OPT_lto_new_pass_manager, OPT_no_lto_new_pass_manager, + args.hasFlag(OPT_no_lto_legacy_pass_manager, OPT_lto_legacy_pass_manager, LLVM_ENABLE_NEW_PASS_MANAGER); config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager); config->mapFile = args.getLastArgValue(OPT_Map); diff --git a/lld/wasm/Options.td b/lld/wasm/Options.td index 92368b171fa9..ae5ec20d07e8 100644 --- a/lld/wasm/Options.td +++ b/lld/wasm/Options.td @@ -220,7 +220,7 @@ def thinlto_cache_dir: J<"thinlto-cache-dir=">, defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">; def thinlto_jobs: J<"thinlto-jobs=">, HelpText<"Number of ThinLTO jobs. Default to --threads=">; -defm lto_new_pass_manager: BB<"lto-new-pass-manager", "Use new pass manager", "Use legacy pass manager">; +defm lto_legacy_pass_manager: BB<"lto-legacy-pass-manager", "Use legacy pass manager", "Use new pass manager">; def lto_debug_pass_manager: F<"lto-debug-pass-manager">, HelpText<"Debug new pass manager">; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ce8b393 - [RISCV] Add DAG combine to turn (setcc X, 1, setne) -> (setcc X, 0, seteq) if we can prove X is 0/1.
Author: Craig Topper Date: 2021-01-19T11:21:48-08:00 New Revision: ce8b3937ddad39536e6e715813682d9198229fb5 URL: https://github.com/llvm/llvm-project/commit/ce8b3937ddad39536e6e715813682d9198229fb5 DIFF: https://github.com/llvm/llvm-project/commit/ce8b3937ddad39536e6e715813682d9198229fb5.diff LOG: [RISCV] Add DAG combine to turn (setcc X, 1, setne) -> (setcc X, 0, seteq) if we can prove X is 0/1. If we are able to compare with 0 instead of 1, we might be able to fold the setcc into a beqz/bnez. Often these setccs start life as an xor that gets converted to a setcc by DAG combiner's rebuildSetcc. I looked into a detecting (xor X, 1) and converting to (seteq X, 0) based on boolean contents being 0/1 in rebuildSetcc instead of using computeKnownBits. It was very perturbing to AMDGPU tests which I didn't look closely at. It had a few changes on a couple other targets, but didn't seem to be much if any improvement. Reviewed By: lenary Differential Revision: https://reviews.llvm.org/D94730 Added: Modified: llvm/include/llvm/CodeGen/ISDOpcodes.h llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/test/CodeGen/RISCV/double-br-fcmp.ll llvm/test/CodeGen/RISCV/float-br-fcmp.ll llvm/test/CodeGen/RISCV/half-br-fcmp.ll llvm/test/CodeGen/RISCV/select-and.ll llvm/test/CodeGen/RISCV/select-or.ll Removed: diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h index 5358b15437cc..1974e2f842c9 100644 --- a/llvm/include/llvm/CodeGen/ISDOpcodes.h +++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h @@ -1332,6 +1332,12 @@ inline bool isUnsignedIntSetCC(CondCode Code) { return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE; } +/// Return true if this is a setcc instruction that performs an equality +/// comparison when used with integer operands. +inline bool isIntEqualitySetCC(CondCode Code) { + return Code == SETEQ || Code == SETNE; +} + /// Return true if the specified condition returns true if the two operands to /// the condition are equal. Note that if one of the two operands is a NaN, /// this value is meaningless. diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 8ca30d654421..4359d24acafc 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -447,6 +447,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, // We can use any register for comparisons setHasMultipleConditionRegisters(); + setTargetDAGCombine(ISD::SETCC); if (Subtarget.hasStdExtZbp()) { setTargetDAGCombine(ISD::OR); } @@ -1961,7 +1962,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N, SDValue RHS = N->getOperand(1); auto CCVal = static_cast(N->getConstantOperandVal(2)); APInt Mask = APInt::getBitsSetFrom(LHS.getValueSizeInBits(), 1); -if ((CCVal == ISD::SETNE || CCVal == ISD::SETEQ) && isNullConstant(RHS) && +if (ISD::isIntEqualitySetCC(CCVal) && isNullConstant(RHS) && LHS.getOpcode() == ISD::XOR && isOneConstant(LHS.getOperand(1)) && DAG.MaskedValueIsZero(LHS.getOperand(0), Mask)) { SDLoc DL(N); @@ -1973,6 +1974,22 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N, } break; } + case ISD::SETCC: { +// (setcc X, 1, setne) -> (setcc X, 0, seteq) if we can prove X is 0/1. +// Comparing with 0 may allow us to fold into bnez/beqz. +SDValue LHS = N->getOperand(0); +SDValue RHS = N->getOperand(1); +auto CC = cast(N->getOperand(2))->get(); +APInt Mask = APInt::getBitsSetFrom(LHS.getValueSizeInBits(), 1); +if (isOneConstant(RHS) && ISD::isIntEqualitySetCC(CC) && +DAG.MaskedValueIsZero(LHS, Mask)) { + SDLoc DL(N); + SDValue Zero = DAG.getConstant(0, DL, LHS.getValueType()); + CC = ISD::getSetCCInverse(CC, LHS.getValueType()); + return DAG.getSetCC(DL, N->getValueType(0), LHS, Zero, CC); +} +break; + } } return SDValue(); diff --git a/llvm/test/CodeGen/RISCV/double-br-fcmp.ll b/llvm/test/CodeGen/RISCV/double-br-fcmp.ll index 6336d7b12ef3..4fe3d9d0465e 100644 --- a/llvm/test/CodeGen/RISCV/double-br-fcmp.ll +++ b/llvm/test/CodeGen/RISCV/double-br-fcmp.ll @@ -411,8 +411,7 @@ define void @br_fcmp_ueq(double %a, double %b) nounwind { ; RV32IFD-NEXT:flt.d a0, ft1, ft0 ; RV32IFD-NEXT:flt.d a1, ft0, ft1 ; RV32IFD-NEXT:or a0, a1, a0 -; RV32IFD-NEXT:addi a1, zero, 1 -; RV32IFD-NEXT:bne a0, a1, .LBB9_2 +; RV32IFD-NEXT:beqz a0, .LBB9_2 ; RV32IFD-NEXT: # %bb.1: # %if.else ; RV32IFD-NEXT:lw ra, 12(sp) # 4-byte Folded Reload ; RV32IFD-NEXT:addi sp, sp, 16 @@ -429,8 +428,7 @@ define void @br_fcmp_ueq(double %a, double %b) nounwind { ; RV64IFD-NEXT:flt.d a0, ft1, ft0 ; RV64IFD-NEXT:flt.d a1, ft0, ft1 ; RV64IFD-NEXT:or a0, a1, a0
[llvm-branch-commits] [clang] 82e537a - [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR
Author: Shilei Tian Date: 2021-01-19T14:18:42-05:00 New Revision: 82e537a9d28a2c18bd1637e2eac0e0af658ed829 URL: https://github.com/llvm/llvm-project/commit/82e537a9d28a2c18bd1637e2eac0e0af658ed829 DIFF: https://github.com/llvm/llvm-project/commit/82e537a9d28a2c18bd1637e2eac0e0af658ed829.diff LOG: [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR D94745 rewrites the `deviceRTLs` using OpenMP and compiles it by directly calling the device compilation. `clang` crashes because entry in `OffloadEntriesDeviceGlobalVar` is unintialized. Current design supposes the device compilation can only be invoked after host compilation with the host IR such that `clang` can initialize `OffloadEntriesDeviceGlobalVar` from host IR. This avoids us using device compilation directly, especially when we only have code wrapped into `declare target` which are all device code. The same issue also exists for `OffloadEntriesInfoManager`. In this patch, we simply initialized an entry if it is not in the maps. Not sure we need an option to tell the device compiler that it is invoked standalone. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D94871 Added: clang/test/OpenMP/declare_target_device_only_compilation.cpp Modified: clang/lib/CodeGen/CGOpenMPRuntime.cpp Removed: diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index a3b24039365b..17fa56fb06c8 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -2941,16 +2941,12 @@ void CGOpenMPRuntime::OffloadEntriesInfoManagerTy:: // If we are emitting code for a target, the entry is already initialized, // only has to be registered. if (CGM.getLangOpts().OpenMPIsDevice) { -if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum)) { - unsigned DiagID = CGM.getDiags().getCustomDiagID( - DiagnosticsEngine::Error, - "Unable to find target region on line '%0' in the device code."); - CGM.getDiags().Report(DiagID) << LineNum; - return; -} +// This could happen if the device compilation is invoked standalone. +if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum)) + initializeTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum, + OffloadingEntriesNum); auto &Entry = OffloadEntriesTargetRegion[DeviceID][FileID][ParentName][LineNum]; -assert(Entry.isValid() && "Entry not initialized!"); Entry.setAddress(Addr); Entry.setID(ID); Entry.setFlags(Flags); @@ -3017,9 +3013,10 @@ void CGOpenMPRuntime::OffloadEntriesInfoManagerTy:: OMPTargetGlobalVarEntryKind Flags, llvm::GlobalValue::LinkageTypes Linkage) { if (CGM.getLangOpts().OpenMPIsDevice) { +// This could happen if the device compilation is invoked standalone. +if (!hasDeviceGlobalVarEntryInfo(VarName)) + initializeDeviceGlobalVarEntryInfo(VarName, Flags, OffloadingEntriesNum); auto &Entry = OffloadEntriesDeviceGlobalVar[VarName]; -assert(Entry.isValid() && Entry.getFlags() == Flags && - "Entry not initialized!"); assert((!Entry.getAddress() || Entry.getAddress() == Addr) && "Resetting with the new address."); if (Entry.getAddress() && hasDeviceGlobalVarEntryInfo(VarName)) { diff --git a/clang/test/OpenMP/declare_target_device_only_compilation.cpp b/clang/test/OpenMP/declare_target_device_only_compilation.cpp new file mode 100644 index ..280959540306 --- /dev/null +++ b/clang/test/OpenMP/declare_target_device_only_compilation.cpp @@ -0,0 +1,15 @@ +//==/// +// RUN: %clang -S -target powerpc64le-ibm-linux-gnu -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s +// RUN: %clang -S -target i386-pc-linux-gnu -fopenmp -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s +// RUN: %clang -S -target x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s +// expected-no-diagnostics + +#pragma omp declare target +#pragma omp begin declare variant match(device={kind(nohost)}) +int G1; +#pragma omp end declare variant +#pragma omp end declare target + +// CHECK: @[[G:.+]] = hidden {{.*}}global i32 0, align 4 +// CHECK: !omp_offload.info = !{!0} +// CHECK: !0 = !{i32 1, !"[[G]]", i32 0, i32 0} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] 933518f - [libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent
Author: Louis Dionne Date: 2021-01-19T14:15:48-05:00 New Revision: 933518fff82c8f39626bbcca81adc516483a9651 URL: https://github.com/llvm/llvm-project/commit/933518fff82c8f39626bbcca81adc516483a9651 DIFF: https://github.com/llvm/llvm-project/commit/933518fff82c8f39626bbcca81adc516483a9651.diff LOG: [libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent Previously, LIBCXX_ENABLE_FILESYSTEM controlled only whether the filesystem support was compiled into libc++'s library. This commit promotes the setting to a first-class option like LIBCXX_ENABLE_LOCALIZATION, where the whole library is aware of the setting and features that depend on won't be provided at all. The test suite is also properly annotated such that tests that depend on are disabled when the library doesn't support it. This is an alternative to https://llvm.org/D94824, but also an improvement along the lines of LIBCXX_ENABLE_LOCALIZATION that I had been wanting to make for a while. Differential Revision: https://reviews.llvm.org/D94921 Added: libcxx/cmake/caches/Generic-no-filesystem.cmake Modified: libcxx/CMakeLists.txt libcxx/include/__config_site.in libcxx/include/filesystem libcxx/include/fstream libcxx/test/configs/legacy.cfg.in libcxx/test/libcxx/double_include.sh.cpp libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp libcxx/test/libcxx/experimental/filesystem/version.pass.cpp libcxx/test/libcxx/min_max_macros.compile.pass.cpp libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp libcxx/test/libcxx/modules/stds_include.sh.cpp libcxx/test/libcxx/no_assert_include.compile.pass.cpp libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp libcxx/test/std/input.output/filesystems/lit.local.cfg libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp libcxx/utils/ci/buildkite-pipeline.yml libcxx/utils/ci/macos-backdeployment.sh libcxx/utils/ci/run-buildbot libcxx/utils/generate_feature_test_macro_components.py libcxx/utils/generate_header_tests.py libcxx/utils/libcxx/test/features.py libcxx/utils/libcxx/test/params.py Removed: diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 46a669500548..6a55245ab87a 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -845,6 +845,7 @@ config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME) config_define_if(LIBCXX_ENABLE_PARALLEL_ALGORITHMS _LIBCPP_HAS_PARALLEL_ALGORITHMS) +config_define_if_not(LIBCXX_ENABLE_FILESYSTEM _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE) config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION) config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) diff --git a/libcxx/cmake/caches/Generic-no-filesystem.cmake b/libcxx/cmake/caches/Generic-no-filesystem.cmake new file mode 100644 index ..4000f3a3e8ef --- /dev/null +++ b/libcxx/cmake/caches/Generic-no-filesystem.cmake @@ -0,0 +1 @@ +set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "") diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in index 6089fb7d0133..ec4d410bb971 100644 --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -30,6 +30,7 @@ #cmakedefine _LIBCPP_NO_VCRUNTIME #cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@ #cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ +#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS #cmakedefine _LIBCPP_HAS_NO_RANDO
[llvm-branch-commits] [libcxx] 68dba7e - [libc++] Unbreak the debug mode
Author: Louis Dionne Date: 2021-01-19T14:15:31-05:00 New Revision: 68dba7eae1df333738d1c77cbbefd480995c1972 URL: https://github.com/llvm/llvm-project/commit/68dba7eae1df333738d1c77cbbefd480995c1972 DIFF: https://github.com/llvm/llvm-project/commit/68dba7eae1df333738d1c77cbbefd480995c1972.diff LOG: [libc++] Unbreak the debug mode When the Debug mode is enabled, we disable extern declarations because we don't want to use the functions compiled in the library, which might not have had the debug mode enabled when built. However, some extern declarations need to be kept, because code correctness depends on it. 31e820378b8a removed those declarations, which had the unintended consequence of breaking the debug build. This commit fixes that by re-introducing a separate macro for the required extern declarations, and adds a comment so that we don't fall into that trap in the future. Differential Revision: https://reviews.llvm.org/D94718 Added: libcxx/test/libcxx/debug/extern-templates.sh.cpp Modified: libcxx/include/__config libcxx/include/__locale libcxx/include/locale Removed: diff --git a/libcxx/include/__config b/libcxx/include/__config index a6ed66857d75..a3838c89e8e1 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -885,18 +885,30 @@ typedef unsigned int char32_t; #endif // _LIBCPP_DEBUG_LEVEL is always defined to one of [0, 1, 2] at this point -#if _LIBCPP_DEBUG_LEVEL >= 1 -# define _LIBCPP_DISABLE_EXTERN_TEMPLATE +#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE) +# define _LIBCPP_EXTERN_TEMPLATE(...) #endif #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE -#define _LIBCPP_EXTERN_TEMPLATE(...) +# define _LIBCPP_EXTERN_TEMPLATE(...) +# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) #endif #ifndef _LIBCPP_EXTERN_TEMPLATE #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; #endif +// When the Debug mode is enabled, we disable extern declarations because we +// don't want to use the functions compiled in the library, which might not +// have had the debug mode enabled when built. However, some extern declarations +// need to be used, because code correctness depends on it (several instances +// in the ). Those special declarations are declared with +// _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled even +// when the debug mode is enabled. +#ifndef _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE +# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; +#endif + #ifndef _LIBCPP_EXTERN_TEMPLATE_DEFINE #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__; #endif diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 7b7331d74a01..a2da7d78049f 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -339,8 +339,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const return static_cast(__h); } -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate) // template class collate_byname; @@ -1451,13 +1451,13 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() } _LIBCPP_SUPPRESS_DEPRECATED_POP -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // deprecated in C++20 #ifndef _LIBCPP_NO_HAS_CHAR8_T -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 +_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname) // C++20 #endif template diff --git a/libcxx/include/locale b/libcxx/include/locale index 4e
[llvm-branch-commits] [clang] e678656 - Add bounds checking assertions to APValue, NFC
Author: Reid Kleckner Date: 2021-01-19T11:15:02-08:00 New Revision: e678656625a3e2b6a5f2849f4a6f7612ceeaed07 URL: https://github.com/llvm/llvm-project/commit/e678656625a3e2b6a5f2849f4a6f7612ceeaed07 DIFF: https://github.com/llvm/llvm-project/commit/e678656625a3e2b6a5f2849f4a6f7612ceeaed07.diff LOG: Add bounds checking assertions to APValue, NFC These checks help find llvm.org/pr48582 without ASan Added: Modified: clang/include/clang/AST/APValue.h Removed: diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h index f9b189926c76..5f4ac02f53c9 100644 --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -537,10 +537,12 @@ class APValue { } APValue &getStructBase(unsigned i) { assert(isStruct() && "Invalid accessor"); +assert(i < getStructNumBases() && "base class index OOB"); return ((StructData *)(char *)&Data)->Elts[i]; } APValue &getStructField(unsigned i) { assert(isStruct() && "Invalid accessor"); +assert(i < getStructNumFields() && "field index OOB"); return ((StructData *)(char *)&Data)->Elts[getStructNumBases() + i]; } const APValue &getStructBase(unsigned i) const { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 6f69f2e - Consider ASan messages interesting for creduce
Author: Reid Kleckner Date: 2021-01-19T11:15:02-08:00 New Revision: 6f69f2ed61ae805df496fc86ef22e7685573d556 URL: https://github.com/llvm/llvm-project/commit/6f69f2ed61ae805df496fc86ef22e7685573d556 DIFF: https://github.com/llvm/llvm-project/commit/6f69f2ed61ae805df496fc86ef22e7685573d556.diff LOG: Consider ASan messages interesting for creduce Helped me reduce llvm.org/pr48582 Added: Modified: clang/utils/creduce-clang-crash.py Removed: diff --git a/clang/utils/creduce-clang-crash.py b/clang/utils/creduce-clang-crash.py index cdc639c6f854..51f4d9d333bc 100755 --- a/clang/utils/creduce-clang-crash.py +++ b/clang/utils/creduce-clang-crash.py @@ -134,7 +134,8 @@ def read_expected_output(self): r"UNREACHABLE executed at .+?!", r"LLVM IR generation of declaration '.+'", r"Generating code for declaration '.+'", - r"\*\*\* Bad machine code: .+ \*\*\*"] + r"\*\*\* Bad machine code: .+ \*\*\*", + r"ERROR: .*Sanitizer: [^ ]+ "] for msg_re in regexes: match = re.search(msg_re, crash_output) if match: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 121cac0 - [noalias.decl] Look through llvm.experimental.noalias.scope.decl
Author: Jeroen Dobbelaere Date: 2021-01-19T20:09:42+01:00 New Revision: 121cac01e8f8afe6ed2bb0b8ffe92f323776a716 URL: https://github.com/llvm/llvm-project/commit/121cac01e8f8afe6ed2bb0b8ffe92f323776a716 DIFF: https://github.com/llvm/llvm-project/commit/121cac01e8f8afe6ed2bb0b8ffe92f323776a716.diff LOG: [noalias.decl] Look through llvm.experimental.noalias.scope.decl Just like llvm.assume, there are a lot of cases where we can just ignore llvm.experimental.noalias.scope.decl. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D93042 Added: llvm/test/Analysis/BasicAA/noalias-scope-decl.ll llvm/test/Analysis/MemorySSA/noalias-scope-decl.ll llvm/test/Transforms/EarlyCSE/noalias-scope-decl.ll llvm/test/Transforms/LoopVectorize/noalias-scope-decl.ll Modified: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/include/llvm/Analysis/VectorUtils.h llvm/lib/Analysis/AliasSetTracker.cpp llvm/lib/Analysis/MemorySSA.cpp llvm/lib/Analysis/ValueTracking.cpp llvm/lib/Analysis/VectorUtils.cpp llvm/lib/CodeGen/Analysis.cpp llvm/lib/Transforms/Scalar/EarlyCSE.cpp llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/test/Analysis/AliasSet/intrinsics.ll llvm/test/Analysis/CostModel/X86/free-intrinsics.ll llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll Removed: diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index 47de99b02d97..1e9201430168 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -557,6 +557,7 @@ class TargetTransformInfoImplBase { case Intrinsic::is_constant: case Intrinsic::lifetime_start: case Intrinsic::lifetime_end: +case Intrinsic::experimental_noalias_scope_decl: case Intrinsic::objectsize: case Intrinsic::ptr_annotation: case Intrinsic::var_annotation: diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index ce3cb22dcd6e..26cb0e456ed4 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -304,7 +304,7 @@ typedef unsigned ID; /// the incoming type is void, we return void. If the EC represents a /// scalar, we return the scalar type. inline Type *ToVectorTy(Type *Scalar, ElementCount EC) { - if (Scalar->isVoidTy() || EC.isScalar()) + if (Scalar->isVoidTy() || Scalar->isMetadataTy() || EC.isScalar()) return Scalar; return VectorType::get(Scalar, EC); } diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 9b21fbf4c9b7..486b4d99dfae 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -438,6 +438,7 @@ void AliasSetTracker::addUnknown(Instruction *Inst) { break; // FIXME: Add lifetime/invariant intrinsics (See: PR30807). case Intrinsic::assume: +case Intrinsic::experimental_noalias_scope_decl: case Intrinsic::sideeffect: case Intrinsic::pseudoprobe: return; diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index f0d27e0b2c6b..52dca7d378e1 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -285,6 +285,7 @@ instructionClobbersQuery(const MemoryDef *MD, const MemoryLocation &UseLoc, case Intrinsic::invariant_start: case Intrinsic::invariant_end: case Intrinsic::assume: +case Intrinsic::experimental_noalias_scope_decl: return {false, NoAlias}; case Intrinsic::dbg_addr: case Intrinsic::dbg_declare: @@ -1767,9 +1768,15 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I, // dependencies here. // FIXME: Replace this special casing with a more accurate modelling of // assume's control dependency. - if (IntrinsicInst *II = dyn_cast(I)) -if (II->getIntrinsicID() == Intrinsic::assume) + if (IntrinsicInst *II = dyn_cast(I)) { +switch (II->getIntrinsicID()) { +default: + break; +case Intrinsic::assume: +case Intrinsic::experimental_noalias_scope_decl: return nullptr; +} + } // Using a nonstandard AA pipelines might leave us with unexpected modref // results for I, so add a check to not model instructions that may not read diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 7f8f101d42af..4f0c7057089b 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -536,6 +536,7 @@ bool llvm::isAssumeLikeIntrinsic(const Instruction *I) { case Intrinsic::invariant_end: case Intrinsic::lifetime_start: case Intrinsic::lifetime_end: +
[llvm-branch-commits] [clang] 987760b - [www] Fix background color in table cell.
Author: Richard Smith Date: 2021-01-19T11:04:31-08:00 New Revision: 987760b463c1303121fff8197c4ebc66b61f0616 URL: https://github.com/llvm/llvm-project/commit/987760b463c1303121fff8197c4ebc66b61f0616 DIFF: https://github.com/llvm/llvm-project/commit/987760b463c1303121fff8197c4ebc66b61f0616.diff LOG: [www] Fix background color in table cell. Added: Modified: clang/www/cxx_status.html Removed: diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html index 923b13db73a6..685f32dbe0d3 100755 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -1005,7 +1005,7 @@ C++20 implementation status Class types as non-type template parameters https://wg21.link/p0732r2";>P0732R2 - Clang 12 + Clang 12 https://wg21.link/p1907r1";>P1907R1 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 57443bf - [Hexagon] Fix segment start to adjust for gaps between segments
Author: Brendon Cahoon Date: 2021-01-19T12:49:39-06:00 New Revision: 57443bfb4ab06f7dc45f802119efc1068289cdd9 URL: https://github.com/llvm/llvm-project/commit/57443bfb4ab06f7dc45f802119efc1068289cdd9 DIFF: https://github.com/llvm/llvm-project/commit/57443bfb4ab06f7dc45f802119efc1068289cdd9.diff LOG: [Hexagon] Fix segment start to adjust for gaps between segments The Hexagon Vector Combine pass genertes stores for a complete aligned vector. The start of each section is a multiple of the vector size, so that value is passed to normalize to compute the offset of the stores in the section. The first store may not occur at offset 0 when there is a gap between sections. Added: llvm/test/CodeGen/Hexagon/autohvx/vector-align-store-mask.ll Modified: llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp Removed: diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp index 01fd8a9ef9ce..a605fdfcf100 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp @@ -198,7 +198,7 @@ class AlignVectors { int extent() const; ByteSpan section(int Start, int Length) const; -ByteSpan &normalize(); +ByteSpan &shift(int Offset); int size() const { return Blocks.size(); } Block &operator[](int i) { return Blocks[i]; } @@ -348,16 +348,9 @@ auto AlignVectors::ByteSpan::section(int Start, int Length) const -> ByteSpan { return Section; } -auto AlignVectors::ByteSpan::normalize() -> ByteSpan & { - if (size() == 0) -return *this; - int Min = Blocks[0].Pos; - for (int i = 1, e = size(); i != e; ++i) -Min = std::min(Min, Blocks[i].Pos); - if (Min != 0) { -for (Block &B : Blocks) - B.Pos -= Min; - } +auto AlignVectors::ByteSpan::shift(int Offset) -> ByteSpan & { + for (Block &B : Blocks) +B.Pos += Offset; return *this; } @@ -794,7 +787,7 @@ auto AlignVectors::realignGroup(const MoveGroup &Move) const -> bool { } for (ByteSpan::Block &B : VSpan) { - ByteSpan Section = ASpan.section(B.Pos, B.Seg.Size).normalize(); + ByteSpan Section = ASpan.section(B.Pos, B.Seg.Size).shift(-B.Pos); Value *Accum = UndefValue::get(HVC.getByteTy(B.Seg.Size)); for (ByteSpan::Block &S : Section) { Value *Pay = HVC.vbytes(Builder, getPayload(S.Seg.Val)); @@ -830,7 +823,9 @@ auto AlignVectors::realignGroup(const MoveGroup &Move) const -> bool { // Create an extra "undef" sector at the beginning and at the end. // They will be used as the left/right filler in the vlalign step. for (int i = -1; i != NumSectors + 1; ++i) { - ByteSpan Section = VSpan.section(i * ScLen, ScLen).normalize(); + // For stores, the size of each section is an aligned vector length. + // Adjust the store offsets relative to the section start offset. + ByteSpan Section = VSpan.section(i * ScLen, ScLen).shift(-i * ScLen); Value *AccumV = UndefValue::get(SecTy); Value *AccumM = HVC.getNullValue(SecTy); for (ByteSpan::Block &S : Section) { diff --git a/llvm/test/CodeGen/Hexagon/autohvx/vector-align-store-mask.ll b/llvm/test/CodeGen/Hexagon/autohvx/vector-align-store-mask.ll new file mode 100644 index ..d63366fc1ca9 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/autohvx/vector-align-store-mask.ll @@ -0,0 +1,36 @@ +; RUN: llc -march=hexagon -hexagon-hvx-widen=32 < %s | FileCheck %s + +target triple = "hexagon" + +; Test the the store mask is adjusted for gaps between sections. The +; Vector Combine pass generates masked stores for chunks of 128 bytes. +; The masked store must be shifted if the first store in a section +; is not a multiple of 128 bytes. This test checks that two masks +; are created, and the second mask is used in a masked store. + +; CHECK: [[REG:r[0-9]+]] = ##.LCPI0_1 +; CHECK: [[VREG1:v[0-9]+]] = vmem([[REG]]+#0) +; CHECK: [[VREG2:v[0-9]+]] = vlalign([[VREG1]],v{{[0-9]+}},r{{[0-9]+}}) +; CHECK: [[QREG:q[0-3]+]] = vand([[VREG2]],r{{[0-9]+}}) +; CHECK: if ([[QREG]]) vmem({{.*}}) = v{{[0-9]+}} + +define dllexport void @f0(i32* %a0) local_unnamed_addr #0 { +b0: + br label %b1 + +b1: ; preds = %b1, %b0 + %v0 = or i32 -1, 40 + %v1 = getelementptr inbounds i32, i32* %a0, i32 %v0 + %v2 = bitcast i32* %v1 to <8 x i32>* + store <8 x i32> undef, <8 x i32>* %v2, align 32 + %v3 = or i32 0, 48 + %v4 = getelementptr inbounds i32, i32* %a0, i32 %v3 + %v5 = bitcast i32* %v4 to <8 x i32>* + store <8 x i32> undef, <8 x i32>* %v5, align 64 + br i1 undef, label %b2, label %b1 + +b2: ; preds = %b1 + ret void +} + +attributes #0 = { "target-features"="+hvxv66,+hvx-length128b" } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm
[llvm-branch-commits] [clang-tools-extra] 17846ed - [clangd] Use ASTSignals in Heuristics CC Ranking.
Author: Utkarsh Saxena Date: 2021-01-19T19:48:42+01:00 New Revision: 17846ed5af4a83334ef7d07f0b4a9d525e6ec0db URL: https://github.com/llvm/llvm-project/commit/17846ed5af4a83334ef7d07f0b4a9d525e6ec0db DIFF: https://github.com/llvm/llvm-project/commit/17846ed5af4a83334ef7d07f0b4a9d525e6ec0db.diff LOG: [clangd] Use ASTSignals in Heuristics CC Ranking. Differential Revision: https://reviews.llvm.org/D94927 Added: Modified: clang-tools-extra/clangd/Quality.cpp Removed: diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp index 1c41b7c7661f..b49392bc7d04 100644 --- a/clang-tools-extra/clangd/Quality.cpp +++ b/clang-tools-extra/clangd/Quality.cpp @@ -474,6 +474,21 @@ float SymbolRelevanceSignals::evaluateHeuristics() const { if (NeedsFixIts) Score *= 0.5f; + // Use a sigmoid style boosting function similar to `References`, which flats + // out nicely for large values. This avoids a sharp gradient for heavily + // referenced symbols. Use smaller gradient for ScopeRefsInFile since ideally + // MainFileRefs <= ScopeRefsInFile. + if (MainFileRefs >= 2) { +// E.g.: (2, 1.12), (9, 2.0), (48, 3.0). +float S = std::pow(MainFileRefs, -0.11); +Score *= 11.0 * (1 - S) / (1 + S) + 0.7; + } + if (ScopeRefsInFile >= 2) { +// E.g.: (2, 1.04), (14, 2.0), (109, 3.0), (400, 3.6). +float S = std::pow(ScopeRefsInFile, -0.10); +Score *= 10.0 * (1 - S) / (1 + S) + 0.7; + } + return Score; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 18cb744 - [AMDGPU] Simpler names for arch-specific ttmp registers. NFC.
Author: Jay Foad Date: 2021-01-19T18:47:14Z New Revision: 18cb7441b69a22565dcc340bac0e58bc9f301439 URL: https://github.com/llvm/llvm-project/commit/18cb7441b69a22565dcc340bac0e58bc9f301439 DIFF: https://github.com/llvm/llvm-project/commit/18cb7441b69a22565dcc340bac0e58bc9f301439.diff LOG: [AMDGPU] Simpler names for arch-specific ttmp registers. NFC. Rename the *_gfx9_gfx10 ttmp registers to *_gfx9plus for simplicity, and use the corresponding isGFX9Plus predicate to decide when to use them instead of the old *_vi versions. Differential Revision: https://reviews.llvm.org/D94975 Added: Modified: llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp llvm/lib/Target/AMDGPU/SIDefines.h llvm/lib/Target/AMDGPU/SIRegisterInfo.td llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index 7f68174e506d..08b340c8fd66 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -997,8 +997,8 @@ unsigned AMDGPUDisassembler::getTtmpClassId(const OpWidthTy Width) const { int AMDGPUDisassembler::getTTmpIdx(unsigned Val) const { using namespace AMDGPU::EncValues; - unsigned TTmpMin = isGFX9Plus() ? TTMP_GFX9_GFX10_MIN : TTMP_VI_MIN; - unsigned TTmpMax = isGFX9Plus() ? TTMP_GFX9_GFX10_MAX : TTMP_VI_MAX; + unsigned TTmpMin = isGFX9Plus() ? TTMP_GFX9PLUS_MIN : TTMP_VI_MIN; + unsigned TTmpMax = isGFX9Plus() ? TTMP_GFX9PLUS_MAX : TTMP_VI_MAX; return (TTmpMin <= Val && Val <= TTmpMax)? Val - TTmpMin : -1; } diff --git a/llvm/lib/Target/AMDGPU/SIDefines.h b/llvm/lib/Target/AMDGPU/SIDefines.h index b9a2bcf81903..f7555f0453bb 100644 --- a/llvm/lib/Target/AMDGPU/SIDefines.h +++ b/llvm/lib/Target/AMDGPU/SIDefines.h @@ -247,8 +247,8 @@ enum : unsigned { SGPR_MAX_GFX10 = 105, TTMP_VI_MIN = 112, TTMP_VI_MAX = 123, - TTMP_GFX9_GFX10_MIN = 108, - TTMP_GFX9_GFX10_MAX = 123, + TTMP_GFX9PLUS_MIN = 108, + TTMP_GFX9PLUS_MAX = 123, INLINE_INTEGER_C_MIN = 128, INLINE_INTEGER_C_POSITIVE_MAX = 192, // 64 INLINE_INTEGER_C_MAX = 208, diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.td b/llvm/lib/Target/AMDGPU/SIRegisterInfo.td index 378fc5df21e5..92390f1f3297 100644 --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.td +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.td @@ -246,9 +246,9 @@ def TMA : RegisterWithSubRegs<"tma", [TMA_LO, TMA_HI]> { } foreach Index = 0...15 in { - defm TTMP#Index#_vi : SIRegLoHi16<"ttmp"#Index, !add(112, Index)>; - defm TTMP#Index#_gfx9_gfx10 : SIRegLoHi16<"ttmp"#Index, !add(108, Index)>; - defm TTMP#Index : SIRegLoHi16<"ttmp"#Index, 0>; + defm TTMP#Index#_vi : SIRegLoHi16<"ttmp"#Index, !add(112, Index)>; + defm TTMP#Index#_gfx9plus : SIRegLoHi16<"ttmp"#Index, !add(108, Index)>; + defm TTMP#Index : SIRegLoHi16<"ttmp"#Index, 0>; } multiclass FLAT_SCR_LOHI_m ci_e, bits<16> vi_e> { @@ -419,8 +419,8 @@ class TmpRegTuples.ret>; foreach Index = {0, 2, 4, 6, 8, 10, 12, 14} in { - def TTMP#Index#_TTMP#!add(Index,1)#_vi : TmpRegTuples<"_vi", 2, Index>; - def TTMP#Index#_TTMP#!add(Index,1)#_gfx9_gfx10 : TmpRegTuples<"_gfx9_gfx10", 2, Index>; + def TTMP#Index#_TTMP#!add(Index,1)#_vi : TmpRegTuples<"_vi", 2, Index>; + def TTMP#Index#_TTMP#!add(Index,1)#_gfx9plus : TmpRegTuples<"_gfx9plus", 2, Index>; } foreach Index = {0, 4, 8, 12} in { @@ -429,7 +429,7 @@ foreach Index = {0, 4, 8, 12} in { _TTMP#!add(Index,3)#_vi : TmpRegTuples<"_vi", 4, Index>; def TTMP#Index#_TTMP#!add(Index,1)# _TTMP#!add(Index,2)# - _TTMP#!add(Index,3)#_gfx9_gfx10 : TmpRegTuples<"_gfx9_gfx10", 4, Index>; + _TTMP#!add(Index,3)#_gfx9plus : TmpRegTuples<"_gfx9plus", 4, Index>; } foreach Index = {0, 4, 8} in { @@ -446,7 +446,7 @@ foreach Index = {0, 4, 8} in { _TTMP#!add(Index,4)# _TTMP#!add(Index,5)# _TTMP#!add(Index,6)# - _TTMP#!add(Index,7)#_gfx9_gfx10 : TmpRegTuples<"_gfx9_gfx10", 8, Index>; + _TTMP#!add(Index,7)#_gfx9plus : TmpRegTuples<"_gfx9plus", 8, Index>; } def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_vi : @@ -456,12 +456,12 @@ def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TT TTMP8_vi, TTMP9_vi, TTMP10_vi, TTMP11_vi, TTMP12_vi, TTMP13_vi, TTMP14_vi, TTMP15_vi]>; -def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_gfx9_gfx10 : +def TTMP0_TTMP1_TTMP2_TTMP3_TTMP4_TTMP5_TTMP6_TTMP7_TTMP8_TTMP9_TTMP10_TTMP11_TTMP12_TTMP13_TTMP14_TTMP15_gfx9plu
[llvm-branch-commits] [llvm] cbf5246 - Fix buildbot after cfc60730179042a93cb9cb338982e71d20707a24
Author: Jessica Paquette Date: 2021-01-19T10:38:04-08:00 New Revision: cbf52463599c860243d29877021fcdfcd9d46553 URL: https://github.com/llvm/llvm-project/commit/cbf52463599c860243d29877021fcdfcd9d46553 DIFF: https://github.com/llvm/llvm-project/commit/cbf52463599c860243d29877021fcdfcd9d46553.diff LOG: Fix buildbot after cfc60730179042a93cb9cb338982e71d20707a24 Windows buildbots were not happy with using find_if + instructionsWithoutDebug. In cfc60730179042a9, instructionsWithoutDebug is not technically necessary. So, just iterate over the block directly. http://lab.llvm.org:8011/#/builders/127/builds/4732/steps/7/logs/stdio Added: Modified: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp Removed: diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index c142c7a70c95..df0219fcfa64 100644 --- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp @@ -625,13 +625,10 @@ bool CombinerHelper::isPredecessor(const MachineInstr &DefMI, if (&DefMI == &UseMI) return false; const MachineBasicBlock &MBB = *DefMI.getParent(); - auto NonDbgInsts = - instructionsWithoutDebug(MBB.instr_begin(), MBB.instr_end()); - auto DefOrUse = - find_if(NonDbgInsts, [&DefMI, &UseMI](const MachineInstr &MI) { -return &MI == &DefMI || &MI == &UseMI; - }); - if (DefOrUse == NonDbgInsts.end()) + auto DefOrUse = find_if(MBB, [&DefMI, &UseMI](const MachineInstr &MI) { +return &MI == &DefMI || &MI == &UseMI; + }); + if (DefOrUse == MBB.end()) llvm_unreachable("Block must contain both DefMI and UseMI!"); return &*DefOrUse == &DefMI; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] cfc6073 - [GlobalISel] Combine (a[0]) | (a[1] << k1) | ...| (a[m] << kn) into a wide load
Author: Jessica Paquette Date: 2021-01-19T10:24:27-08:00 New Revision: cfc60730179042a93cb9cb338982e71d20707a24 URL: https://github.com/llvm/llvm-project/commit/cfc60730179042a93cb9cb338982e71d20707a24 DIFF: https://github.com/llvm/llvm-project/commit/cfc60730179042a93cb9cb338982e71d20707a24.diff LOG: [GlobalISel] Combine (a[0]) | (a[1] << k1) | ...| (a[m] << kn) into a wide load This is a restricted version of the combine in `DAGCombiner::MatchLoadCombine`. (See D27861) This tries to recognize patterns like below (assuming a little-endian target): ``` s8* x = ... s32 val = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24) -> s32 val = *((i32)a) s8* x = ... s32 val = a[3] | (a[2] << 8) | (a[1] << 16) | (a[0] << 24) -> s32 val = BSWAP(*((s32)a)) ``` (This patch also handles the big-endian target case as well, in which the first example above has a BSWAP, and the second example above does not.) To recognize the pattern, this searches from the last G_OR in the expression tree. E.g. ``` Reg Reg \/ OR_1 Reg \/ OR_2 \ Reg .. / Root ``` Each non-OR register in the tree is put in a list. Each register in the list is then checked to see if it's an appropriate load + shift logic. If every register is a load + potentially a shift, the combine checks if those loads + shifts, when OR'd together, are equivalent to a wide load (possibly with a BSWAP.) To simplify things, this patch (1) Only handles G_ZEXTLOADs (which appear to be the common case) (2) Only works in a single MachineBasicBlock (3) Only handles G_SHL as the bit twiddling to stick the small load into a specific location An IR example of this is here: https://godbolt.org/z/4sP9Pj (lifted from test/CodeGen/AArch64/load-combine.ll) At -Os on AArch64, this is a 0.5% code size improvement for CTMark/sqlite3, and a 0.4% improvement for CTMark/7zip-benchmark. Also fix a bug in `isPredecessor` which caused it to fail whenever `DefMI` was the first instruction in the block. Differential Revision: https://reviews.llvm.org/D94350 Added: llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-load-or-pattern-align.mir llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-load-or-pattern.mir Modified: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h llvm/include/llvm/CodeGen/TargetLowering.h llvm/include/llvm/Target/GlobalISel/Combine.td llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp llvm/lib/CodeGen/TargetLoweringBase.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h index 0d240e90820f..8570f5ca5dd5 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h @@ -18,6 +18,7 @@ #define LLVM_CODEGEN_GLOBALISEL_COMBINER_HELPER_H #include "llvm/ADT/APFloat.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/CodeGen/LowLevelType.h" #include "llvm/CodeGen/Register.h" #include "llvm/Support/Alignment.h" @@ -471,6 +472,20 @@ class CombinerHelper { bool applyCombineInsertVecElts(MachineInstr &MI, SmallVectorImpl &MatchInfo); + /// Match expression trees of the form + /// + /// \code + /// sN *a = ... + /// sM val = a[0] | (a[1] << N) | (a[2] << 2N) | (a[3] << 3N) ... + /// \endcode + /// + /// And check if the tree can be replaced with a M-bit load + possibly a + /// bswap. + bool matchLoadOrCombine(MachineInstr &MI, + std::function &MatchInfo); + bool applyLoadOrCombine(MachineInstr &MI, + std::function &MatchInfo); + /// Try to transform \p MI by using all of the above /// combine functions. Returns true if changed. bool tryCombine(MachineInstr &MI); @@ -499,6 +514,30 @@ class CombinerHelper { /// \returns true if a candidate is found. bool findPreIndexCandidate(MachineInstr &MI, Register &Addr, Register &Base, Register &Offset); + + /// Helper function for matchLoadOrCombine. Searches for Registers + /// which may have been produced by a load instruction + some arithmetic. + /// + /// \param [in] Root - The search root. + /// + /// \returns The Registers found during the search. + Optional> + findCandidatesForLoadOrCombine(const MachineInstr *Root) const; + + /// Helper function for matchLoadOrCombine. + /// + /// Checks if every register in \p RegsToVisit is defined by a load + /// instruction + some arithmetic. + /// + /// \param [out] MemOffset2Idx - Maps the byte positions each load ends up + /// at to the index of the load. + /// \param [in] MemSizeInBits - The number of bits each load should produce. + /// + /// \returns The lowest-index load found and the lowest index on success. + Optional> findLoadOffsetsForLoadOrComb
[llvm-branch-commits] [llvm] 9c6a00f - [RISCV] Add ISel patterns for scalable mask exts & truncs
Author: Fraser Cormack Date: 2021-01-19T18:13:15Z New Revision: 9c6a00fe99c4bbe329dd1933515f1a1a430fd5d7 URL: https://github.com/llvm/llvm-project/commit/9c6a00fe99c4bbe329dd1933515f1a1a430fd5d7 DIFF: https://github.com/llvm/llvm-project/commit/9c6a00fe99c4bbe329dd1933515f1a1a430fd5d7.diff LOG: [RISCV] Add ISel patterns for scalable mask exts & truncs Original patch by @rogfer01. This patch adds support for sign-, zero-, and any-extension from scalable mask vector types to integer vector types, as well as truncation in the opposite direction. Authored-by: Roger Ferrer Ibanez Co-Authored-by: Fraser Cormack Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D94590 Added: llvm/test/CodeGen/RISCV/rvv/mask-exts-truncs-rv32.ll llvm/test/CodeGen/RISCV/rvv/mask-exts-truncs-rv64.ll Modified: llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVISelLowering.h Removed: diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 14795b5465be..8ca30d654421 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -373,9 +373,18 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM, setOperationAction(ISD::UMIN, VT, Legal); setOperationAction(ISD::UMAX, VT, Legal); - // Lower RVV truncates as a series of "RISCVISD::TRUNCATE_VECTOR" - // nodes which truncate by one power of two at a time. - setOperationAction(ISD::TRUNCATE, VT, Custom); + if (isTypeLegal(VT)) { +// Custom-lower extensions and truncations from/to mask types. +setOperationAction(ISD::ANY_EXTEND, VT, Custom); +setOperationAction(ISD::SIGN_EXTEND, VT, Custom); +setOperationAction(ISD::ZERO_EXTEND, VT, Custom); + +// We custom-lower all legally-typed vector truncates: +// 1. Mask VTs are custom-expanded into a series of standard nodes +// 2. Integer VTs are lowered as a series of "RISCVISD::TRUNCATE_VECTOR" +// nodes which truncate by one power of two at a time. +setOperationAction(ISD::TRUNCATE, VT, Custom); + } } // We must custom-lower SPLAT_VECTOR vXi64 on RV32 @@ -690,15 +699,19 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op, DAG.getTargetConstant(Imm, DL, Subtarget.getXLenVT())); } case ISD::TRUNCATE: { -// RVV only has truncates which operate from SEW*2->SEW, so lower arbitrary -// truncates as a series of "RISCVISD::TRUNCATE_VECTOR" nodes which -// truncate by one power of two at a time. SDLoc DL(Op); EVT VT = Op.getValueType(); -// Only custom-lower non-mask truncates -if (!VT.isVector() || VT.getVectorElementType() == MVT::i1) +// Only custom-lower vector truncates +if (!VT.isVector()) return Op; +// Truncates to mask types are handled diff erently +if (VT.getVectorElementType() == MVT::i1) + return lowerVectorMaskTrunc(Op, DAG); + +// RVV only has truncates which operate from SEW*2->SEW, so lower arbitrary +// truncates as a series of "RISCVISD::TRUNCATE_VECTOR" nodes which +// truncate by one power of two at a time. EVT DstEltVT = VT.getVectorElementType(); SDValue Src = Op.getOperand(0); @@ -721,6 +734,11 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op, return Result; } + case ISD::ANY_EXTEND: + case ISD::ZERO_EXTEND: +return lowerVectorMaskExt(Op, DAG, /*ExtVal*/ 1); + case ISD::SIGN_EXTEND: +return lowerVectorMaskExt(Op, DAG, /*ExtVal*/ -1); case ISD::SPLAT_VECTOR: return lowerSPLATVECTOR(Op, DAG); case ISD::VSCALE: { @@ -1198,6 +1216,76 @@ SDValue RISCVTargetLowering::lowerSPLATVECTOR(SDValue Op, return DAG.getNode(ISD::OR, DL, VecVT, Lo, Hi); } +// Custom-lower extensions from mask vectors by using a vselect either with 1 +// for zero/any-extension or -1 for sign-extension: +// (vXiN = (s|z)ext vXi1:vmask) -> (vXiN = vselect vmask, (-1 or 1), 0) +// Note that any-extension is lowered identically to zero-extension. +SDValue RISCVTargetLowering::lowerVectorMaskExt(SDValue Op, SelectionDAG &DAG, +int64_t ExtTrueVal) const { + SDLoc DL(Op); + EVT VecVT = Op.getValueType(); + SDValue Src = Op.getOperand(0); + // Only custom-lower extensions from mask types + if (!Src.getValueType().isVector() || + Src.getValueType().getVectorElementType() != MVT::i1) +return Op; + + // Be careful not to introduce illegal scalar types at this stage, and be + // careful also about splatting constants as on RV32, vXi64 SPLAT_VECTOR is + // illegal and must be expanded. Since we know that the constants are + // sign-extended 32-bit values, we use SPLAT_VECTOR_I64 directly. + bool IsRV32E64 = + !Subtarget.is64Bit() && VecVT.ge
[llvm-branch-commits] [llvm] 88e7c34 - [SystemZ][z/OS] Fix Permission denied pattern matching
Author: Abhina Sreeskantharajan Date: 2021-01-19T13:05:52-05:00 New Revision: 88e7c3498c3a8827c3706e39609b22dea9045432 URL: https://github.com/llvm/llvm-project/commit/88e7c3498c3a8827c3706e39609b22dea9045432 DIFF: https://github.com/llvm/llvm-project/commit/88e7c3498c3a8827c3706e39609b22dea9045432.diff LOG: [SystemZ][z/OS] Fix Permission denied pattern matching On z/OS, the error message "EDC5111I Permission denied." is not matched correctly in lit tests. This patch updates the check expression to match successfully. Differential Revision: https://reviews.llvm.org/D94432 Added: Modified: llvm/test/tools/llvm-ar/error-opening-permission.test Removed: diff --git a/llvm/test/tools/llvm-ar/error-opening-permission.test b/llvm/test/tools/llvm-ar/error-opening-permission.test index 00f80c0a1848..d8d0cbfd3556 100644 --- a/llvm/test/tools/llvm-ar/error-opening-permission.test +++ b/llvm/test/tools/llvm-ar/error-opening-permission.test @@ -11,4 +11,4 @@ # RUN: not llvm-ar p %t/permission.b 2>&1 | \ # RUN: FileCheck %s --check-prefix=NO-PERMISSION -DARCHIVE=%t/permission.b -# NO-PERMISSION: error: unable to open '[[ARCHIVE]]': {{[pP]}}ermission denied +# NO-PERMISSION: error: unable to open '[[ARCHIVE]]': {{.*}}{{[pP]}}ermission denied ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 2f80995 - [lldb][docs] Update .htaccess to redirect from old SB API documentation to new one
Author: Raphael Isemann Date: 2021-01-19T18:58:43+01:00 New Revision: 2f8099509030d3352ac211b1fbae4c6c32b0bfa7 URL: https://github.com/llvm/llvm-project/commit/2f8099509030d3352ac211b1fbae4c6c32b0bfa7 DIFF: https://github.com/llvm/llvm-project/commit/2f8099509030d3352ac211b1fbae4c6c32b0bfa7.diff LOG: [lldb][docs] Update .htaccess to redirect from old SB API documentation to new one This is mostly SEO so that the new API can take over the old API when people search for the different SB* classes. Sadly epydoc decided to throw in a -class prefix behind all the class file names, so we can't just overwrite the old files with the newly generated ones. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94900 Added: Modified: lldb/docs/.htaccess Removed: diff --git a/lldb/docs/.htaccess b/lldb/docs/.htaccess index 31b80359fb5fe..7f84a78df0a68 100644 --- a/lldb/docs/.htaccess +++ b/lldb/docs/.htaccess @@ -18,3 +18,89 @@ Redirect 301 /use/architecture.html https://lldb.llvm.org/resources/architecture Redirect 301 /resources/architecture.html https://lldb.llvm.org/design/overview.html Redirect 301 /resources/reproducers.html https://lldb.llvm.org/design/reproducers.html Redirect 301 /resources/sbapi.html https://lldb.llvm.org/design/sbapi.html + +# Redirect old Python API to new Python API. +Redirect 301 /python_reference/lldb-module.html https://lldb.llvm.org/python_api.html + +Redirect 301 /python_reference/lldb.SBAddress-class.html https://lldb.llvm.org/python_api/lldb.SBAddress.html +Redirect 301 /python_reference/lldb.SBAttachInfo-class.html https://lldb.llvm.org/python_api/lldb.SBAttachInfo.html +Redirect 301 /python_reference/lldb.SBBlock-class.html https://lldb.llvm.org/python_api/lldb.SBBlock.html +Redirect 301 /python_reference/lldb.SBBreakpoint-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpoint.html +Redirect 301 /python_reference/lldb.SBBreakpointList-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointList.html +Redirect 301 /python_reference/lldb.SBBreakpointLocation-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointLocation.html +Redirect 301 /python_reference/lldb.SBBreakpointName-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointName.html +Redirect 301 /python_reference/lldb.SBBroadcaster-class.html https://lldb.llvm.org/python_api/lldb.SBBroadcaster.html +Redirect 301 /python_reference/lldb.SBCommandInterpreter-class.html https://lldb.llvm.org/python_api/lldb.SBCommandInterpreter.html +Redirect 301 /python_reference/lldb.SBCommandInterpreterRunOptions-class.html https://lldb.llvm.org/python_api/lldb.SBCommandInterpreterRunOptions.html +Redirect 301 /python_reference/lldb.SBCommandReturnObject-class.html https://lldb.llvm.org/python_api/lldb.SBCommandReturnObject.html +Redirect 301 /python_reference/lldb.SBCommunication-class.html https://lldb.llvm.org/python_api/lldb.SBCommunication.html +Redirect 301 /python_reference/lldb.SBCompileUnit-class.html https://lldb.llvm.org/python_api/lldb.SBCompileUnit.html +Redirect 301 /python_reference/lldb.SBData-class.html https://lldb.llvm.org/python_api/lldb.SBData.html +Redirect 301 /python_reference/lldb.SBDebugger-class.html https://lldb.llvm.org/python_api/lldb.SBDebugger.html +Redirect 301 /python_reference/lldb.SBDeclaration-class.html https://lldb.llvm.org/python_api/lldb.SBDeclaration.html +Redirect 301 /python_reference/lldb.SBEnvironment-class.html https://lldb.llvm.org/python_api/lldb.SBEnvironment.html +Redirect 301 /python_reference/lldb.SBError-class.html https://lldb.llvm.org/python_api/lldb.SBError.html +Redirect 301 /python_reference/lldb.SBEvent-class.html https://lldb.llvm.org/python_api/lldb.SBEvent.html +Redirect 301 /python_reference/lldb.SBExecutionContext-class.html https://lldb.llvm.org/python_api/lldb.SBExecutionContext.html +Redirect 301 /python_reference/lldb.SBExpressionOptions-class.html https://lldb.llvm.org/python_api/lldb.SBExpressionOptions.html +Redirect 301 /python_reference/lldb.SBFile-class.html https://lldb.llvm.org/python_api/lldb.SBFile.html +Redirect 301 /python_reference/lldb.SBFileSpec-class.html https://lldb.llvm.org/python_api/lldb.SBFileSpec.html +Redirect 301 /python_reference/lldb.SBFileSpecList-class.html https://lldb.llvm.org/python_api/lldb.SBFileSpecList.html +Redirect 301 /python_reference/lldb.SBFrame-class.html https://lldb.llvm.org/python_api/lldb.SBFrame.html +Redirect 301 /python_reference/lldb.SBFunction-class.html https://lldb.llvm.org/python_api/lldb.SBFunction.html +Redirect 301 /python_reference/lldb.SBHostOS-class.html https://lldb.llvm.org/python_api/lldb.SBHostOS.html +Redirect 301 /python_reference/lldb.SBInstruction-class.html https://lldb.llvm.org/python_api/lldb.SBInstruction.html +Redirect 301 /python_reference/lldb.SBInstructionList-class.html https://lldb.llvm.org/python_api/lld
[llvm-branch-commits] [llvm] 6a563ee - [ARM] Expand vXi1 VSELECT's
Author: David Green Date: 2021-01-19T17:56:50Z New Revision: 6a563eef1321f742fa06482f4536cd41fb8e24c7 URL: https://github.com/llvm/llvm-project/commit/6a563eef1321f742fa06482f4536cd41fb8e24c7 DIFF: https://github.com/llvm/llvm-project/commit/6a563eef1321f742fa06482f4536cd41fb8e24c7.diff LOG: [ARM] Expand vXi1 VSELECT's We have no lowering for VSELECT vXi1, vXi1, vXi1, so mark them as expanded to turn them into a series of logical operations. Differential Revision: https://reviews.llvm.org/D94946 Added: llvm/test/CodeGen/Thumb2/mve-pred-vselect.ll Modified: llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/test/Analysis/CostModel/ARM/arith-overflow.ll llvm/test/Analysis/CostModel/ARM/arith-ssat.ll Removed: diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 46c5efa2cf2f8..aabfad045d9fa 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -444,6 +444,8 @@ void ARMTargetLowering::addMVEVectorTypes(bool HasMVEFP) { setOperationAction(ISD::LOAD, VT, Custom); setOperationAction(ISD::STORE, VT, Custom); setOperationAction(ISD::TRUNCATE, VT, Custom); +setOperationAction(ISD::VSELECT, VT, Expand); +setOperationAction(ISD::SELECT, VT, Expand); } } diff --git a/llvm/test/Analysis/CostModel/ARM/arith-overflow.ll b/llvm/test/Analysis/CostModel/ARM/arith-overflow.ll index 172df86003569..0a29083f27f5c 100644 --- a/llvm/test/Analysis/CostModel/ARM/arith-overflow.ll +++ b/llvm/test/Analysis/CostModel/ARM/arith-overflow.ll @@ -68,20 +68,20 @@ define i32 @sadd(i32 %arg) { ; MVE-RECIP-LABEL: 'sadd' ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %I64 = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 undef, i64 undef) ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %V2I64 = call { <2 x i64>, <2 x i1> } @llvm.sadd.with.overflow.v2i64(<2 x i64> undef, <2 x i64> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 166 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.sadd.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 582 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.sadd.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 242 for instruction: %V4I64 = call { <4 x i64>, <4 x i1> } @llvm.sadd.with.overflow.v4i64(<4 x i64> undef, <4 x i64> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 866 for instruction: %V8I64 = call { <8 x i64>, <8 x i1> } @llvm.sadd.with.overflow.v8i64(<8 x i64> undef, <8 x i64> undef) ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I32 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 undef, i32 undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %V4I32 = call { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32> undef, <4 x i32> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %V8I32 = call { <8 x i32>, <8 x i1> } @llvm.sadd.with.overflow.v8i32(<8 x i32> undef, <8 x i32> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %V16I32 = call { <16 x i32>, <16 x i1> } @llvm.sadd.with.overflow.v16i32(<16 x i32> undef, <16 x i32> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 90 for instruction: %V4I32 = call { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32> undef, <4 x i32> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 306 for instruction: %V8I32 = call { <8 x i32>, <8 x i1> } @llvm.sadd.with.overflow.v8i32(<8 x i32> undef, <8 x i32> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 1122 for instruction: %V16I32 = call { <16 x i32>, <16 x i1> } @llvm.sadd.with.overflow.v16i32(<16 x i32> undef, <16 x i32> undef) ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I16 = call { i16, i1 } @llvm.sadd.with.overflow.i16(i16 undef, i16 undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %V8I16 = call { <8 x i16>, <8 x i1> } @llvm.sadd.with.overflow.v8i16(<8 x i16> undef, <8 x i16> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %V16I16 = call { <16 x i16>, <16 x i1> } @llvm.sadd.with.overflow.v16i16(<16 x i16> undef, <16 x i16> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 44 for instruction: %V32I16 = call { <32 x i16>, <32 x i1> } @llvm.sadd.with.overflow.v32i16(<32 x i16> undef, <32 x i16> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 298 for instruction: %V8I16 = call { <8 x i16>, <8 x i1> } @llvm.sadd.with.overflow.v8i16(<8 x i16> undef, <8 x i16> und
[llvm-branch-commits] [lldb] 3cae8b3 - [lldb][docs] Add a doc page for enums and constants
Author: Raphael Isemann Date: 2021-01-19T18:54:05+01:00 New Revision: 3cae8b33297b14449514a87dcaa8996ba40db412 URL: https://github.com/llvm/llvm-project/commit/3cae8b33297b14449514a87dcaa8996ba40db412 DIFF: https://github.com/llvm/llvm-project/commit/3cae8b33297b14449514a87dcaa8996ba40db412.diff LOG: [lldb][docs] Add a doc page for enums and constants Enums and constants are currently missing in the new LLDB Python API docs. In theory we could just let them be autogenerated like the SB API classes, but sadly the generated documentation suffers from a bunch of problems. Most of these problems come from the way SWIG is representing enums, which is done by translating every single enum case into its own constant. This has a bunch of nasty effects: * Because SWIG throws away the enum types, we can't actually reference the enum type itself in the API. Also because automodapi is impossible to script, this can't be fixed in post (at least without running like sed over the output files). * The lack of enum types also causes that every enum *case* has its own full doc page. Having a full doc page that just shows a single enum case is pointless and it really slows down sphinx. * There is no SWIG code for the enums, so there is also no place to write documentation strings for them. Also there is no support for copying the doxygen strings (which would be in the wrong format, but better than nothing) for enums (let alone our defines), so we can't really document all this code. * Because the enum cases are just forwards to the native lldb module (which we mock), automodapi actually takes the `Mock` docstrings and adds it to every single enum case. I don't see any way to solve this via automodapi or SWIG. The most reasonable way to solve this is IMHO to write a simple Clang tool that just parses our enum/constant headers and emits an *.rst file that we check in. This way we can do all the LLDB-specific enum case and constant grouping that we need to make a readable documentation page. As we're without any real documentation until I get around to write that tool, I wrote a doc page for the enums/constants as a stop gap measure. Most of this is done by just grepping our enum header and then manually cleaning up all the artifacts and copying the few doc strings we have. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94959 Added: lldb/docs/python_api_enums.rst Modified: lldb/bindings/interface/SBLanguageRuntime.i lldb/bindings/python/python.swig Removed: diff --git a/lldb/bindings/interface/SBLanguageRuntime.i b/lldb/bindings/interface/SBLanguageRuntime.i index 244c57048e64d..d8698ee36c0dd 100644 --- a/lldb/bindings/interface/SBLanguageRuntime.i +++ b/lldb/bindings/interface/SBLanguageRuntime.i @@ -9,7 +9,7 @@ namespace lldb { %feature("docstring", -"Utility functions for :py:class:`LanguageType`" +"Utility functions for :ref:`LanguageType`" ) SBLanguageRuntime; class SBLanguageRuntime { diff --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig index 599699e33c45d..9dc4ab87a4bd9 100644 --- a/lldb/bindings/python/python.swig +++ b/lldb/bindings/python/python.swig @@ -28,7 +28,11 @@ Some of the important classes are described here: * :py:class:`SBFunction`: Represents a generic function, which can be inlined or not. * :py:class:`SBBlock`: Represents a lexical block. :py:class:`SBFunction` contains SBBlocks. * :py:class:`SBLineEntry`: Specifies an association with a contiguous range of instructions - and a source file location. :py:class:`SBCompileUnit` contains SBLineEntry." + and a source file location. :py:class:`SBCompileUnit` contains SBLineEntry. + +The diff erent enums in the `lldb` module are described in :doc:`python_api_enums`. + +" %enddef /* diff --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst new file mode 100644 index 0..b00ac47bd1fa1 --- /dev/null +++ b/lldb/docs/python_api_enums.rst @@ -0,0 +1,1257 @@ +.. + This is a sub page of the Python API docs and linked from the main API page. + The page isn't in any toctree, so silence the sphinx warnings by marking it as orphan. + +:orphan: + +Python API enumerators and constants + + +.. py:currentmodule:: lldb + +Constants +* + +Generic register numbers + + +.. py:data:: LLDB_REGNUM_GENERIC_PC + + Program counter. + +.. py:data:: LLDB_REGNUM_GENERIC_SP + + Stack pointer. +.. py:data:: LLDB_REGNUM_GENERIC_FP + + Frame pointer. + +.. py:data:: LLDB_REGNUM_GENERIC_RA + + Return address. + +.. py:data:: LLDB_REGNUM_GENERIC_FLAGS + + Processor flags register. + +.. py:data:: LLDB_REGNUM_GENERIC_ARG1 + + The register that would contain pointer size or less argument 1 (if any). + +.. py:data:: LLDB_REGNUM_GENERIC_ARG2 + + The register that would con
[llvm-branch-commits] [flang] cea3abc - [flang][driver] Move isFixedFormSuffix and isFreeFormSuffix to flangFrontend
Author: Andrzej Warzynski Date: 2021-01-19T17:47:40Z New Revision: cea3abc26f7cbc4ec4cf4cf73b4cce5f926420a9 URL: https://github.com/llvm/llvm-project/commit/cea3abc26f7cbc4ec4cf4cf73b4cce5f926420a9 DIFF: https://github.com/llvm/llvm-project/commit/cea3abc26f7cbc4ec4cf4cf73b4cce5f926420a9.diff LOG: [flang][driver] Move isFixedFormSuffix and isFreeFormSuffix to flangFrontend isFixedFormSuffix and isFreeFormSuffix should be defined in flangFrontend rather than flangFrontendTool library. That's for 2 reasons: * these methods are used in flangFrontend rather than flangFrontendTool * flangFrontendTool depends on flangFrontend As mentioned in the post-commit review for D94228, without this change shared library builds fail. Differential Revision: https://reviews.llvm.org/D94968 Added: Modified: flang/include/flang/Frontend/FrontendOptions.h flang/include/flang/FrontendTool/Utils.h flang/lib/Frontend/FrontendAction.cpp flang/lib/Frontend/FrontendOptions.cpp flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp Removed: diff --git a/flang/include/flang/Frontend/FrontendOptions.h b/flang/include/flang/Frontend/FrontendOptions.h index 7add145971cf..9bebf6c8f35d 100644 --- a/flang/include/flang/Frontend/FrontendOptions.h +++ b/flang/include/flang/Frontend/FrontendOptions.h @@ -35,6 +35,14 @@ enum ActionKind { /// EmitCodeGenOnly, EmitAssembly, (...) }; +/// \param suffix The file extension +/// \return True if the file extension should be processed as fixed form +bool isFixedFormSuffix(llvm::StringRef suffix); + +/// \param suffix The file extension +/// \return True if the file extension should be processed as free form +bool isFreeFormSuffix(llvm::StringRef suffix); + inline const char *GetActionKindName(const ActionKind ak) { switch (ak) { case InputOutputTest: diff --git a/flang/include/flang/FrontendTool/Utils.h b/flang/include/flang/FrontendTool/Utils.h index 7ee7568e21de..d62c03d8dc0b 100644 --- a/flang/include/flang/FrontendTool/Utils.h +++ b/flang/include/flang/FrontendTool/Utils.h @@ -14,8 +14,6 @@ #ifndef LLVM_FLANG_FRONTENDTOOL_UTILS_H #define LLVM_FLANG_FRONTENDTOOL_UTILS_H -#include "llvm/ADT/StringRef.h" - namespace Fortran::frontend { class CompilerInstance; @@ -33,14 +31,6 @@ std::unique_ptr CreateFrontendAction(CompilerInstance &ci); /// \return - True on success. bool ExecuteCompilerInvocation(CompilerInstance *flang); -/// \param suffix The file extension -/// \return True if the file extension should be processed as fixed form -bool isFixedFormSuffix(llvm::StringRef suffix); - -/// \param suffix The file extension -/// \return True if the file extension should be processed as free form -bool isFreeFormSuffix(llvm::StringRef suffix); - } // end namespace Fortran::frontend #endif // LLVM_FLANG_FRONTENDTOOL_UTILS_H diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp index 6da1e6191036..dad2da683860 100644 --- a/flang/lib/Frontend/FrontendAction.cpp +++ b/flang/lib/Frontend/FrontendAction.cpp @@ -9,6 +9,7 @@ #include "flang/Frontend/FrontendAction.h" #include "flang/Frontend/CompilerInstance.h" #include "flang/Frontend/FrontendActions.h" +#include "flang/Frontend/FrontendOptions.h" #include "flang/FrontendTool/Utils.h" #include "llvm/Support/Errc.h" diff --git a/flang/lib/Frontend/FrontendOptions.cpp b/flang/lib/Frontend/FrontendOptions.cpp index 8c206b308176..1f2668fd1e85 100644 --- a/flang/lib/Frontend/FrontendOptions.cpp +++ b/flang/lib/Frontend/FrontendOptions.cpp @@ -7,10 +7,24 @@ //===--===// #include "flang/Frontend/FrontendOptions.h" -#include "flang/FrontendTool/Utils.h" using namespace Fortran::frontend; +bool Fortran::frontend::isFixedFormSuffix(llvm::StringRef suffix) { + // Note: Keep this list in-sync with flang/test/lit.cfg.py + return suffix == "f" || suffix == "F" || suffix == "ff" || suffix == "for" || + suffix == "FOR" || suffix == "fpp" || suffix == "FPP"; +} + +bool Fortran::frontend::isFreeFormSuffix(llvm::StringRef suffix) { + // Note: Keep this list in-sync with flang/test/lit.cfg.py + // TODO: Add Cuda Fortan files (i.e. `*.cuf` and `*.CUF`). + return suffix == "f77" || suffix == "f90" || suffix == "F90" || + suffix == "ff90" || suffix == "f95" || suffix == "F95" || + suffix == "ff95" || suffix == "f03" || suffix == "F03" || + suffix == "f08" || suffix == "F08" || suffix == "f18" || suffix == "F18"; +} + InputKind FrontendOptions::GetInputKindForExtension(llvm::StringRef extension) { if (isFixedFormSuffix(extension) || isFreeFormSuffix(extension)) { return Language::Fortran; diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 6bc63b071a9c..50c9fca0b882 100644 --- a/flang/lib/
[llvm-branch-commits] [mlir] 71b6b01 - [mlir][python] Factor out standalone OpView._ods_build_default class method.
Author: Stella Laurenzo Date: 2021-01-19T09:29:57-08:00 New Revision: 71b6b010e6bc49caaec511195e33ac1f43f07c64 URL: https://github.com/llvm/llvm-project/commit/71b6b010e6bc49caaec511195e33ac1f43f07c64 DIFF: https://github.com/llvm/llvm-project/commit/71b6b010e6bc49caaec511195e33ac1f43f07c64.diff LOG: [mlir][python] Factor out standalone OpView._ods_build_default class method. * This allows us to hoist trait level information for regions and sized-variadic to class level attributes (_ODS_REGIONS, _ODS_OPERAND_SEGMENTS, _ODS_RESULT_SEGMENTS). * Eliminates some splicey python generated code in favor of a native helper for it. * Makes it possible to implement custom, variadic and region based builders with one line of python, without needing to manually code access to the segment attributes. * Needs follow-on work for region based callbacks and support for SingleBlockImplicitTerminator. * A follow-up will actually add ODS support for generating custom Python builders that delegate to this new method. * Also includes the start of an e2e sample for constructing linalg ops where this limitation was discovered (working progressively through this example and cleaning up as I go). Differential Revision: https://reviews.llvm.org/D94738 Added: mlir/examples/python/linalg_matmul.py mlir/test/Bindings/Python/ods_helpers.py Modified: mlir/docs/Bindings/Python.md mlir/lib/Bindings/Python/IRModules.cpp mlir/lib/Bindings/Python/IRModules.h mlir/test/mlir-tblgen/op-python-bindings.td mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp Removed: diff --git a/mlir/docs/Bindings/Python.md b/mlir/docs/Bindings/Python.md index b5595bc7010e..6bb9e7ebe2f6 100644 --- a/mlir/docs/Bindings/Python.md +++ b/mlir/docs/Bindings/Python.md @@ -365,7 +365,7 @@ for the canonical way to use this facility. Each dialect with a mapping to python requires that an appropriate `{DIALECT_NAMESPACE}.py` wrapper module is created. This is done by invoking -`mlir-tablegen` on a python-bindings specific tablegen wrapper that includes +`mlir-tblgen` on a python-bindings specific tablegen wrapper that includes the boilerplate and actual dialect specific `td` file. An example, for the `StandardOps` (which is assigned the namespace `std` as a special case): @@ -383,7 +383,7 @@ In the main repository, building the wrapper is done via the CMake function `add_mlir_dialect_python_bindings`, which invokes: ``` -mlir-tablegen -gen-python-op-bindings -bind-dialect={DIALECT_NAMESPACE} \ +mlir-tblgen -gen-python-op-bindings -bind-dialect={DIALECT_NAMESPACE} \ {PYTHON_BINDING_TD_FILE} ``` @@ -411,7 +411,8 @@ The wrapper module tablegen emitter outputs: Note: In order to avoid naming conflicts, all internal names used by the wrapper module are prefixed by `_ods_`. -Each concrete `OpView` subclass further defines several attributes: +Each concrete `OpView` subclass further defines several public-intended +attributes: * `OPERATION_NAME` attribute with the `str` fully qualified operation name (i.e. `std.absf`). @@ -421,6 +422,20 @@ Each concrete `OpView` subclass further defines several attributes: for unnamed of each). * `@property` getter, setter and deleter for each declared attribute. +It further emits additional private-intended attributes meant for subclassing +and customization (default cases omit these attributes in favor of the +defaults on `OpView`): + +* `_ODS_REGIONS`: A specification on the number and types of regions. + Currently a tuple of (min_region_count, has_no_variadic_regions). Note that + the API does some light validation on this but the primary purpose is to + capture sufficient information to perform other default building and region + accessor generation. +* `_ODS_OPERAND_SEGMENTS` and `_ODS_RESULT_SEGMENTS`: Black-box value which + indicates the structure of either the operand or results with respect to + variadics. Used by `OpView._ods_build_default` to decode operand and result + lists that contain lists. + Builders Presently, only a single, default builder is mapped to the `__init__` method. diff --git a/mlir/examples/python/linalg_matmul.py b/mlir/examples/python/linalg_matmul.py new file mode 100644 index ..83dc15eda9b6 --- /dev/null +++ b/mlir/examples/python/linalg_matmul.py @@ -0,0 +1,73 @@ +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# This is a work in progress example to do end2end build and code generation +# of a small linalg program with configuration options. It is currently non +# functional and is being used to elaborate the APIs. + +from typing import Tuple + +from mlir.ir import * +from mlir.dialects import linalg +from mlir.dialects import std + + +# TODO: This shoul
[llvm-branch-commits] [clang] cbdde49 - [clang-format] Apply Allman style to lambdas
Author: Björn Schäpers Date: 2021-01-19T18:17:01+01:00 New Revision: cbdde495ba28915d52b561e44aaba12db4cf724f URL: https://github.com/llvm/llvm-project/commit/cbdde495ba28915d52b561e44aaba12db4cf724f DIFF: https://github.com/llvm/llvm-project/commit/cbdde495ba28915d52b561e44aaba12db4cf724f.diff LOG: [clang-format] Apply Allman style to lambdas Differential Revision: https://reviews.llvm.org/D94906 Added: Modified: clang/lib/Format/Format.cpp clang/unittests/Format/FormatTest.cpp Removed: diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 9f007819326c..110e1a726f55 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -801,6 +801,7 @@ static FormatStyle expandPresets(const FormatStyle &Style) { Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; Expanded.BraceWrapping.BeforeCatch = true; Expanded.BraceWrapping.BeforeElse = true; +Expanded.BraceWrapping.BeforeLambdaBody = true; break; case FormatStyle::BS_Whitesmiths: Expanded.BraceWrapping.AfterCaseLabel = true; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index ae8bfc60f6d9..1565016802f9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -13481,6 +13481,58 @@ TEST_F(FormatTest, AllmanBraceBreaking) { "#endif", AllmanBraceStyle); + EXPECT_EQ(AllmanBraceStyle.AllowShortLambdasOnASingleLine, +FormatStyle::SLS_All); + + verifyFormat("[](int i) { return i + 2; };\n" + "[](int i, int j)\n" + "{\n" + " auto x = i + j;\n" + " auto y = i * j;\n" + " return x ^ y;\n" + "};\n" + "void foo()\n" + "{\n" + " auto shortLambda = [](int i) { return i + 2; };\n" + " auto longLambda = [](int i, int j)\n" + " {\n" + "auto x = i + j;\n" + "auto y = i * j;\n" + "return x ^ y;\n" + " };\n" + "}", + AllmanBraceStyle); + + AllmanBraceStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_None; + + verifyFormat("[](int i)\n" + "{\n" + " return i + 2;\n" + "};\n" + "[](int i, int j)\n" + "{\n" + " auto x = i + j;\n" + " auto y = i * j;\n" + " return x ^ y;\n" + "};\n" + "void foo()\n" + "{\n" + " auto shortLambda = [](int i)\n" + " {\n" + "return i + 2;\n" + " };\n" + " auto longLambda = [](int i, int j)\n" + " {\n" + "auto x = i + j;\n" + "auto y = i * j;\n" + "return x ^ y;\n" + " };\n" + "}", + AllmanBraceStyle); + + // Reset + AllmanBraceStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All; + // This shouldn't affect ObjC blocks.. verifyFormat("[self doSomeThingWithACompletionHandler:^{\n" " // ...\n" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 051ec9f - [ValueTracking] Strengthen impliesPoison reasoning
Author: Nikita Popov Date: 2021-01-19T18:04:23+01:00 New Revision: 051ec9f5f43a83e23bd3e20e512fc5ec44c19850 URL: https://github.com/llvm/llvm-project/commit/051ec9f5f43a83e23bd3e20e512fc5ec44c19850 DIFF: https://github.com/llvm/llvm-project/commit/051ec9f5f43a83e23bd3e20e512fc5ec44c19850.diff LOG: [ValueTracking] Strengthen impliesPoison reasoning Split impliesPoison into two recursive walks, one over V, the other over ValAssumedPoison. This allows us to reason about poison implications in a number of additional cases that are important in practice. This is a generalized form of D94859, which handles the cmp to cmp implication in particular. Differential Revision: https://reviews.llvm.org/D94866 Added: Modified: llvm/lib/Analysis/ValueTracking.cpp llvm/test/Transforms/InstCombine/select-and-or.ll llvm/unittests/Analysis/ValueTrackingTest.cpp Removed: diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a9cef91e7316..7f8f101d42af 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4806,64 +4806,49 @@ bool llvm::canCreatePoison(const Operator *Op) { return ::canCreateUndefOrPoison(Op, /*PoisonOnly=*/true); } -bool llvm::impliesPoison(const Value *ValAssumedPoison, const Value *V) { - // Construct a set of values which are known to be poison from the knowledge - // that ValAssumedPoison is poison. - SmallPtrSet PoisonValues; - PoisonValues.insert(ValAssumedPoison); - const Instruction *PoisonI = dyn_cast(ValAssumedPoison); - unsigned Depth = 0; - const unsigned MaxDepth = 2; - - while (PoisonI && Depth < MaxDepth) { -// We'd like to know whether an operand of PoisonI is also poison. -if (canCreatePoison(cast(PoisonI))) - // PoisonI can be a poison-generating instruction, so don't look further - break; - -const Value *NextVal = nullptr; -bool MoreThanOneCandidate = false; -// See which operand can be poison -for (const auto &Op : PoisonI->operands()) { - if (!isGuaranteedNotToBeUndefOrPoison(Op.get())) { -// Op can be poison. -if (NextVal) { - // There is more than one operand that can make PoisonI poison. - MoreThanOneCandidate = true; - break; -} -NextVal = Op.get(); - } -} +static bool directlyImpliesPoison(const Value *ValAssumedPoison, + const Value *V, unsigned Depth) { + if (ValAssumedPoison == V) +return true; -if (NextVal == nullptr) { - // All operands are non-poison, so PoisonI cannot be poison. - // Since assumption is false, return true - return true; -} else if (MoreThanOneCandidate) - break; + const unsigned MaxDepth = 2; + if (Depth >= MaxDepth) +return false; -Depth++; -PoisonValues.insert(NextVal); -PoisonI = dyn_cast(NextVal); + const auto *I = dyn_cast(V); + if (I && propagatesPoison(cast(I))) { +return any_of(I->operands(), [=](const Value *Op) { + return directlyImpliesPoison(ValAssumedPoison, Op, Depth + 1); +}); } + return false; +} - if (PoisonValues.contains(V)) +static bool impliesPoison(const Value *ValAssumedPoison, const Value *V, + unsigned Depth) { + if (isGuaranteedNotToBeUndefOrPoison(ValAssumedPoison)) return true; - // Let's look one level further, by seeing its arguments if I was an - // instruction. - // This happens when I is e.g. 'icmp X, const' where X is in PoisonValues. - const auto *I = dyn_cast(V); - if (I && propagatesPoison(cast(I))) { -for (const auto &Op : I->operands()) - if (PoisonValues.count(Op.get())) -return true; - } + if (directlyImpliesPoison(ValAssumedPoison, V, /* Depth */ 0)) +return true; + const unsigned MaxDepth = 2; + if (Depth >= MaxDepth) +return false; + + const auto *I = dyn_cast(ValAssumedPoison); + if (I && !canCreatePoison(cast(I))) { +return all_of(I->operands(), [=](const Value *Op) { + return impliesPoison(Op, V, Depth + 1); +}); + } return false; } +bool llvm::impliesPoison(const Value *ValAssumedPoison, const Value *V) { + return ::impliesPoison(ValAssumedPoison, V, /* Depth */ 0); +} + static bool programUndefinedIfUndefOrPoison(const Value *V, bool PoisonOnly); diff --git a/llvm/test/Transforms/InstCombine/select-and-or.ll b/llvm/test/Transforms/InstCombine/select-and-or.ll index 8681a7349ff9..f3de67649cb1 100644 --- a/llvm/test/Transforms/InstCombine/select-and-or.ll +++ b/llvm/test/Transforms/InstCombine/select-and-or.ll @@ -148,10 +148,9 @@ define i1 @logical_or_noundef_a(i1 noundef %a, i1 %b) { } ; Noundef on false value allows conversion to or. -; TODO: impliesPoison doesn't handle this yet. define i1 @logical_or_noundef_b(i1 %a, i1 noundef %b) { ; CHECK-L
[llvm-branch-commits] [llvm] 0808c70 - [AMDGPU] Fix test case for D94010
Author: Jay Foad Date: 2021-01-19T16:46:47Z New Revision: 0808c7009a06773e78772c7b74d254fd3572f0ea URL: https://github.com/llvm/llvm-project/commit/0808c7009a06773e78772c7b74d254fd3572f0ea DIFF: https://github.com/llvm/llvm-project/commit/0808c7009a06773e78772c7b74d254fd3572f0ea.diff LOG: [AMDGPU] Fix test case for D94010 Added: Modified: llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll index 8df0215a6fe2..5c333f0ce97d 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefixes=GCN,SDAG %s -; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefixes=GCN,GISEL %s +; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s +; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1030 < %s | FileCheck -check-prefix=GCN %s define float @v_fma(float %a, float %b, float %c) { ; GCN-LABEL: v_fma: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 2782049 - [MLIR][SPIRV] Add `SignedOp` trait.
Author: KareemErgawy-TomTom Date: 2021-01-19T17:40:40+01:00 New Revision: 27820496a71d5f73950e0d57b5dead236304b4e7 URL: https://github.com/llvm/llvm-project/commit/27820496a71d5f73950e0d57b5dead236304b4e7 DIFF: https://github.com/llvm/llvm-project/commit/27820496a71d5f73950e0d57b5dead236304b4e7.diff LOG: [MLIR][SPIRV] Add `SignedOp` trait. This commit adds a new trait that can be attached to ops that have signed semantics. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D94896 Added: Modified: mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td mlir/include/mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOpTraits.h Removed: diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td index 99b245563ca6..b211f69bb68e 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td @@ -3117,6 +3117,8 @@ def InModuleScope : PredOpTrait< def UnsignedOp : NativeOpTrait<"spirv::UnsignedOp">; +def SignedOp : NativeOpTrait<"spirv::SignedOp">; + def UsableInSpecConstantOp : NativeOpTrait<"spirv::UsableInSpecConstantOp">; //===--===// diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td index 446066ae067e..5e3bf0b9eccd 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBitOps.td @@ -178,7 +178,8 @@ def SPV_BitFieldInsertOp : SPV_Op<"BitFieldInsert", // - -def SPV_BitFieldSExtractOp : SPV_BitFieldExtractOp<"BitFieldSExtract", []> { +def SPV_BitFieldSExtractOp : SPV_BitFieldExtractOp<"BitFieldSExtract", + [SignedOp]> { let summary = "Extract a bit field from an object, with sign extension."; let description = [{ diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td index 931f16425fe2..e887292cc1fc 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCastOps.td @@ -163,7 +163,10 @@ def SPV_ConvertFToUOp : SPV_CastOp<"ConvertFToU", SPV_Integer, SPV_Float, []> { // - -def SPV_ConvertSToFOp : SPV_CastOp<"ConvertSToF", SPV_Float, SPV_Integer, []> { +def SPV_ConvertSToFOp : SPV_CastOp<"ConvertSToF", + SPV_Float, + SPV_Integer, + [SignedOp]> { let summary = [{ Convert value numerically from signed integer to floating point. }]; @@ -270,7 +273,10 @@ def SPV_FConvertOp : SPV_CastOp<"FConvert", // - -def SPV_SConvertOp : SPV_CastOp<"SConvert", SPV_Integer, SPV_Integer, [UsableInSpecConstantOp]> { +def SPV_SConvertOp : SPV_CastOp<"SConvert", +SPV_Integer, +SPV_Integer, +[UsableInSpecConstantOp, SignedOp]> { let summary = [{ Convert signed width. This is either a truncate or a sign extend. }]; diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td index b4c5662217c8..2e642fd2f3d2 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td @@ -690,7 +690,7 @@ def SPV_LogicalOrOp : SPV_LogicalBinaryOp<"LogicalOr", def SPV_SGreaterThanOp : SPV_LogicalBinaryOp<"SGreaterThan", SPV_Integer, - [UsableInSpecConstantOp]> { + [UsableInSpecConstantOp, SignedOp]> { let summary = [{ Signed-integer comparison if Operand 1 is greater than Operand 2. }]; @@ -725,7 +725,8 @@ def SPV_SGreaterThanOp : SPV_LogicalBinaryOp<"SGreaterThan", def SPV_SGreaterThanEqualOp : SPV_LogicalBinaryOp<"SGreaterThanEqual", SPV_Integer, - [UsableInSpecConstantOp]> { + [UsableInSpecConstantOp, + SignedOp]> { let summary = [{ Signed-integer comparison if Operand 1 is greater than or equal to Operand 2. @@ -761,7 +762,7 @@ def SPV_SGreaterThanEqualOp : SPV_LogicalBinaryOp<"SGreaterThanEqual", def SPV_SLessThanOp : SPV_LogicalBinaryOp<"SLessThan", SPV_Integer, -
[llvm-branch-commits] [llvm] de2f942 - [AMDGPU] Simplify test case for D94010
Author: Jay Foad Date: 2021-01-19T16:36:43Z New Revision: de2f9423995d52a5457752256815dc54d317c8d1 URL: https://github.com/llvm/llvm-project/commit/de2f9423995d52a5457752256815dc54d317c8d1 DIFF: https://github.com/llvm/llvm-project/commit/de2f9423995d52a5457752256815dc54d317c8d1.diff LOG: [AMDGPU] Simplify test case for D94010 Added: Modified: llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll Removed: diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll index 03584312e2af..8df0215a6fe2 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll @@ -10,7 +10,6 @@ define float @v_fma(float %a, float %b, float %c) { ; GCN-NEXT:v_fmac_legacy_f32_e64 v2, v0, v1 ; GCN-NEXT:v_mov_b32_e32 v0, v2 ; GCN-NEXT:s_setpc_b64 s[30:31] -; %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %c) ret float %fma } @@ -22,7 +21,6 @@ define float @v_fabs_fma(float %a, float %b, float %c) { ; GCN-NEXT:s_waitcnt_vscnt null, 0x0 ; GCN-NEXT:v_fma_legacy_f32 v0, |v0|, v1, v2 ; GCN-NEXT:s_setpc_b64 s[30:31] -; %fabs.a = call float @llvm.fabs.f32(float %a) %fma = call float @llvm.amdgcn.fma.legacy(float %fabs.a, float %b, float %c) ret float %fma @@ -35,7 +33,6 @@ define float @v_fneg_fabs_fma(float %a, float %b, float %c) { ; GCN-NEXT:s_waitcnt_vscnt null, 0x0 ; GCN-NEXT:v_fma_legacy_f32 v0, v0, -|v1|, v2 ; GCN-NEXT:s_setpc_b64 s[30:31] -; %fabs.b = call float @llvm.fabs.f32(float %b) %neg.fabs.b = fneg float %fabs.b %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %neg.fabs.b, float %c) @@ -49,92 +46,21 @@ define float @v_fneg_fma(float %a, float %b, float %c) { ; GCN-NEXT:s_waitcnt_vscnt null, 0x0 ; GCN-NEXT:v_fma_legacy_f32 v0, v0, v1, -v2 ; GCN-NEXT:s_setpc_b64 s[30:31] -; %neg.c = fneg float %c %fma = call float @llvm.amdgcn.fma.legacy(float %a, float %b, float %neg.c) ret float %fma } -define amdgpu_ps <{ i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> @main(<4 x i32> addrspace(6)* inreg noalias align 32 dereferenceable(18446744073709551615) %arg, <8 x i32> addrspace(6)* inreg noalias align 32 dereferenceable(18446744073709551615) %arg1, <4 x i32> addrspace(6)* inreg noalias align 32 dereferenceable(18446744073709551615) %arg2, <8 x i32> addrspace(6)* inreg noalias align 32 dereferenceable(18446744073709551615) %arg3, i32 inreg %arg4, i32 inreg %arg5, <2 x i32> %arg6, <2 x i32> %arg7, <2 x i32> %arg8, <3 x i32> %arg9, <2 x i32> %arg10, <2 x i32> %arg11, <2 x i32> %arg12, <3 x float> %arg13, float %arg14, float %arg15, float %arg16, float %arg17, i32 %arg18, i32 %arg19, float %arg20, i32 %arg21) #0 { -; SDAG-LABEL: main: -; SDAG: ; %bb.0: -; SDAG-NEXT:s_mov_b32 s16, exec_lo -; SDAG-NEXT:v_mov_b32_e32 v14, v2 -; SDAG-NEXT:s_mov_b32 s0, s5 -; SDAG-NEXT:s_wqm_b32 exec_lo, exec_lo -; SDAG-NEXT:s_mov_b32 s1, 0 -; SDAG-NEXT:s_mov_b32 m0, s7 -; SDAG-NEXT:s_clause 0x1 -; SDAG-NEXT:s_load_dwordx8 s[8:15], s[0:1], 0x400 -; SDAG-NEXT:s_load_dwordx4 s[0:3], s[0:1], 0x430 -; SDAG-NEXT:v_interp_p1_f32_e32 v2, v0, attr0.x -; SDAG-NEXT:v_interp_p1_f32_e32 v3, v0, attr0.y -; SDAG-NEXT:s_mov_b32 s4, s6 -; SDAG-NEXT:v_interp_p2_f32_e32 v2, v1, attr0.x -; SDAG-NEXT:v_interp_p2_f32_e32 v3, v1, attr0.y -; SDAG-NEXT:s_and_b32 exec_lo, exec_lo, s16 -; SDAG-NEXT:s_waitcnt lgkmcnt(0) -; SDAG-NEXT:image_sample v[0:3], v[2:3], s[8:15], s[0:3] dmask:0xf dim:SQ_RSRC_IMG_2D -; SDAG-NEXT:s_waitcnt vmcnt(0) -; SDAG-NEXT:v_fma_legacy_f32 v0, v0, 2.0, -1.0 -; SDAG-NEXT:v_fma_legacy_f32 v1, v1, 2.0, -1.0 -; SDAG-NEXT:; return to shader part epilog -; -; GISEL-LABEL: main: -; GISEL: ; %bb.0: -; GISEL-NEXT:s_mov_b32 s16, exec_lo -; GISEL-NEXT:s_mov_b32 s4, s6 -; GISEL-NEXT:s_mov_b32 m0, s7 -; GISEL-NEXT:s_wqm_b32 exec_lo, exec_lo -; GISEL-NEXT:s_add_u32 s0, s5, 0x400 -; GISEL-NEXT:s_mov_b32 s1, 0 -; GISEL-NEXT:v_interp_p1_f32_e32 v3, v0, attr0.y -; GISEL-NEXT:s_load_dwordx8 s[8:15], s[0:1], 0x0 -; GISEL-NEXT:s_add_u32 s0, s5, 0x430 -; GISEL-NEXT:v_mov_b32_e32 v14, v2 -; GISEL-NEXT:s_load_dwordx4 s[0:3], s[0:1], 0x0 -; GISEL-NEXT:v_interp_p1_f32_e32 v2, v0, attr0.x -; GISEL-NEXT:v_interp_p2_f32_e32 v3, v1, attr0.y -; GISEL-NEXT:v_interp_p2_f32_e32 v2, v1, attr0.x -; GISEL-NEXT:s_and_b32 exec_lo, exec_lo, s16 -; GISEL-NEXT:s_waitcnt lgkmcnt(0) -; GISEL-NEXT:image_sample v[0:3], v[2:3], s[8:15], s[0:3] dmask:0xf dim:SQ_RSRC_IMG_2D -; GISEL-NEXT:s_waitcnt vmcnt(0) -; GISEL-NEXT:v_fma_legacy_f32 v0, v0, 2.0, -1.0 -; GISEL-NEXT:v_fma_legacy_f32 v1,
[llvm-branch-commits] [openmp] 2d911f7 - [OpenMP] Fix atomic entries for captured logical operation
Author: Hansang Bae Date: 2021-01-19T09:59:28-06:00 New Revision: 2d911f7c72f9174a34f74abe2909f992b03caaf1 URL: https://github.com/llvm/llvm-project/commit/2d911f7c72f9174a34f74abe2909f992b03caaf1 DIFF: https://github.com/llvm/llvm-project/commit/2d911f7c72f9174a34f74abe2909f992b03caaf1.diff LOG: [OpenMP] Fix atomic entries for captured logical operation Added missing code for the captured atomic operation. Differential Revision: https://reviews.llvm.org/D94848 Added: Modified: openmp/runtime/src/kmp_atomic.cpp Removed: diff --git a/openmp/runtime/src/kmp_atomic.cpp b/openmp/runtime/src/kmp_atomic.cpp index 4d60b550ae62..a9d5257ab2aa 100644 --- a/openmp/runtime/src/kmp_atomic.cpp +++ b/openmp/runtime/src/kmp_atomic.cpp @@ -2536,8 +2536,11 @@ ATOMIC_CRITICAL_CPT_MIX(float10, long double, div_cpt, /, fp, _Quad, 10r, \ if (flag) { \ new_value OP rhs; \ - } else \ +(*lhs) = new_value; \ + } else { \ new_value = (*lhs); \ +(*lhs) OP rhs; \ + } \ \ __kmp_release_atomic_lock(&ATOMIC_LOCK##LCK_ID, gtid); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 15fd6ba - [RISCV] Extend RVV VType info with the type's AVL (NFC)
Author: Fraser Cormack Date: 2021-01-19T15:46:56Z New Revision: 15fd6bae0e4938ebbd4751a4ba1c85b4145894b5 URL: https://github.com/llvm/llvm-project/commit/15fd6bae0e4938ebbd4751a4ba1c85b4145894b5 DIFF: https://github.com/llvm/llvm-project/commit/15fd6bae0e4938ebbd4751a4ba1c85b4145894b5.diff LOG: [RISCV] Extend RVV VType info with the type's AVL (NFC) This patch factors out the "VLMax" operand passed to most scalable-vector ISel patterns into a property of each VType. This is seen as a preparatory change to allow RVV in the future to more easily support fixed-length vector types with constrained vector lengths, with the AVL operand set to the length of the fixed-length vector. It has no effect on the scalable code generation path. Reviewed By: HsiangKai Differential Revision: https://reviews.llvm.org/D94594 Added: Modified: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td Removed: diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td index 1406c8645f73..85826b26eedf 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -137,6 +137,9 @@ class VTypeInfo { int SEW = 8; LMULInfo LMul = M; string BX = Bx; // Appendix of mask operations. + // The pattern fragment which produces the AVL operand, representing the + // "natural" vector length for this mask type. For scalable masks this is + // VLMax. + OutPatFrag AVL = VLMax; } defset list AllMasks = { diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td index 5b4051c534a3..4a6571010ec1 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -47,6 +47,7 @@ multiclass VPatUSLoadStoreSDNode { @@ -54,16 +55,16 @@ multiclass VPatUSLoadStoreSDNode("PseudoVSE"#sew#"_V_"#vlmul.MX); // Load def : Pat<(type (load reg_rs1:$rs1)), -(load_instr reg_rs1:$rs1, VLMax, sew)>; +(load_instr reg_rs1:$rs1, avl, sew)>; // Store def : Pat<(store type:$rs2, reg_rs1:$rs1), -(store_instr reg_class:$rs2, reg_rs1:$rs1, VLMax, sew)>; +(store_instr reg_class:$rs2, reg_rs1:$rs1, avl, sew)>; } multiclass VPatUSLoadStoreSDNodes { foreach vti = AllVectors in defm "" : VPatUSLoadStoreSDNode; +vti.AVL, reg_rs1, vti.RegClass>; } class VPatBinarySDNode_VV : Pat<(result_type (vop @@ -81,7 +83,7 @@ class VPatBinarySDNode_VV(instruction_name#"_VV_"# vlmul.MX) op_reg_class:$rs1, op_reg_class:$rs2, - VLMax, sew)>; + avl, sew)>; class VPatBinarySDNode_XI(instruction_name#_#suffix#_# vlmul.MX) vop_reg_class:$rs1, xop_kind:$rs2, - VLMax, sew)>; + avl, sew)>; multiclass VPatBinarySDNode_VV_VX { foreach vti = AllIntegerVectors in { def : VPatBinarySDNode_VV; + vti.LMul, vti.AVL, vti.RegClass, vti.RegClass>; def : VPatBinarySDNode_XI; } } @@ -123,14 +126,14 @@ multiclass VPatBinarySDNode_VV_VX_VI; + vti.LMul, vti.AVL, vti.RegClass, vti.RegClass>; def : VPatBinarySDNode_XI; def : VPatBinarySDNode_XI(SplatPat#_#ImmType), ImmType>; } @@ -144,6 +147,7 @@ class VPatBinarySDNode_VF : @@ -152,16 +156,16 @@ class VPatBinarySDNode_VF(instruction_name#"_VF_"#vlmul.MX) vop_reg_class:$rs1, ToFPR32.ret, - VLMax, sew)>; + avl, sew)>; multiclass VPatBinaryFPSDNode_VV_VF { foreach vti = AllFloatVectors in { def : VPatBinarySDNode_VV; + vti.LMul, vti.AVL, vti.RegClass, vti.RegClass>; def : VPatBinarySDNode_VF; } } @@ -173,7 +177,7 @@ multiclass VPatBinaryFPSDNode_R_VF { (!cast(instruction_name#"_VF_"#fvti.LMul.MX) fvti.RegClass:$rs1, ToFPR32.ret, - VLMax, fvti.SEW)>; + fvti.AVL, fvti.SEW)>; } multiclass VPatIntegerSetCCSDNode_VV.Value>; } } @@ -204,7 +208,7 @@ multiclass VPatIntegerSetCCSDNode_XI.Value>; } } @@ -242,7 +246,7 @@ multiclass VPatFPSetCCSDNode_VV { (fvti.Vector fvti.RegClass:$rs2), cc)), (!cast(instruction_name#"_VV_"#fvti.LMul.MX) - fvti.RegClass:$rs1, fvti.RegClass:$rs2, VLMax, fvti.SEW)>; + fvti.RegClass:$rs1, fvti.RegClass:$rs2, fvti.AVL, fvti.SEW)>; } multiclass VPatFPSetCCSDNode_VF { @@ -253,7 +2
[llvm-branch-commits] [llvm] f373b30 - [ARM] Add MVE add.sat costs
Author: David Green Date: 2021-01-19T15:38:46Z New Revision: f373b30923d7a83985e59ec76a566dd889e684d9 URL: https://github.com/llvm/llvm-project/commit/f373b30923d7a83985e59ec76a566dd889e684d9 DIFF: https://github.com/llvm/llvm-project/commit/f373b30923d7a83985e59ec76a566dd889e684d9.diff LOG: [ARM] Add MVE add.sat costs This adds some basic MVE sadd_sat/ssub_sat/uadd_sat/usub_sat costs, based on when the instruction is legal. With smaller than legal types that are promoted we generate shr(qadd(shl, shl)), so the cost is 4 appropriately. Differential Revision: https://reviews.llvm.org/D94958 Added: Modified: llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp llvm/test/Analysis/CostModel/ARM/arith-ssat.ll llvm/test/Analysis/CostModel/ARM/arith-usat.ll Removed: diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp index a75c771e66be..a94d35118051 100644 --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -1513,15 +1513,39 @@ int ARMTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy, int ARMTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) { - // Currently we make a somewhat optimistic assumption that active_lane_mask's - // are always free. In reality it may be freely folded into a tail predicated - // loop, expanded into a VCPT or expanded into a lot of add/icmp code. We - // may need to improve this in the future, but being able to detect if it - // is free or not involves looking at a lot of other code. We currently assume - // that the vectorizer inserted these, and knew what it was doing in adding - // one. - if (ST->hasMVEIntegerOps() && ICA.getID() == Intrinsic::get_active_lane_mask) -return 0; + switch (ICA.getID()) { + case Intrinsic::get_active_lane_mask: +// Currently we make a somewhat optimistic assumption that +// active_lane_mask's are always free. In reality it may be freely folded +// into a tail predicated loop, expanded into a VCPT or expanded into a lot +// of add/icmp code. We may need to improve this in the future, but being +// able to detect if it is free or not involves looking at a lot of other +// code. We currently assume that the vectorizer inserted these, and knew +// what it was doing in adding one. +if (ST->hasMVEIntegerOps()) + return 0; +break; + case Intrinsic::sadd_sat: + case Intrinsic::ssub_sat: + case Intrinsic::uadd_sat: + case Intrinsic::usub_sat: { +if (!ST->hasMVEIntegerOps()) + break; +std::pair LT = +TLI->getTypeLegalizationCost(DL, ICA.getReturnType()); +if (LT.second == MVT::v4i32 || LT.second == MVT::v8i16 || +LT.second == MVT::v16i8) { + // This is a base cost of 1 for the vadd, plus 3 extract shifts if we + // need to extend the type, as it uses shr(qadd(shl, shl)). + unsigned Instrs = LT.second.getScalarSizeInBits() == +ICA.getReturnType()->getScalarSizeInBits() +? 1 +: 4; + return LT.first * ST->getMVEVectorCostFactor() * Instrs; +} +break; + } + } return BaseT::getIntrinsicInstrCost(ICA, CostKind); } diff --git a/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll b/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll index 13c1a148b249..bc8b23bc001f 100644 --- a/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll +++ b/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll @@ -90,22 +90,22 @@ define i32 @add(i32 %arg) { ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 1046 for instruction: %V8I64 = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> undef, <8 x i64> undef) ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %I32 = call i32 @llvm.sadd.sat.i32(i32 undef, i32 undef) ; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V2I32 = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> undef, <2 x i32> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %V4I32 = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> undef, <4 x i32> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %V8I32 = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> undef, <8 x i32> undef) -; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 62 for instruction: %V16I32 = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> undef, <16 x i32> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> undef, <4 x i32> undef) +; MVE-RECIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> und
[llvm-branch-commits] [flang] 6bd0a44 - [flang][directive] Get rid of flangClassValue in TableGen
Author: Valentin Clement Date: 2021-01-19T10:28:46-05:00 New Revision: 6bd0a4451ccd4a5cbab1f735052edbcafcb856ea URL: https://github.com/llvm/llvm-project/commit/6bd0a4451ccd4a5cbab1f735052edbcafcb856ea DIFF: https://github.com/llvm/llvm-project/commit/6bd0a4451ccd4a5cbab1f735052edbcafcb856ea.diff LOG: [flang][directive] Get rid of flangClassValue in TableGen The TableGen emitter for directives has two slots for flangClass information and this was mainly to be able to keep up with the legacy openmp parser at the time. Now that all clauses are encapsulated in AccClause or OmpClause, these two strings are not necessary anymore and were the the source of couple of problem while working with the generic structure checker for OpenMP. This patch remove the flangClassValue string from DirectiveBase.td and use the string flangClass as the placeholder for the encapsulated class. Reviewed By: sameeranjoshi Differential Revision: https://reviews.llvm.org/D94821 Added: Modified: flang/lib/Lower/OpenMP.cpp flang/lib/Parser/openmp-parsers.cpp flang/lib/Parser/unparse.cpp flang/lib/Semantics/check-omp-structure.cpp llvm/include/llvm/Frontend/Directive/DirectiveBase.td llvm/include/llvm/Frontend/OpenACC/ACC.td llvm/include/llvm/Frontend/OpenMP/OMP.td llvm/include/llvm/TableGen/DirectiveEmitter.h llvm/test/TableGen/directive1.td llvm/test/TableGen/directive2.td llvm/utils/TableGen/DirectiveEmitter.cpp Removed: diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp index f765723bb9ae..c16b1beeb4a7 100644 --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -148,8 +148,9 @@ genOMP(Fortran::lower::AbstractConverter &converter, std::get(beginBlockDirective.t); for (const auto &clause : parallelOpClauseList.v) { if (const auto &ifClause = - std::get_if(&clause.u)) { -auto &expr = std::get(ifClause->t); + std::get_if(&clause.u)) { +auto &expr = +std::get(ifClause->v.t); ifClauseOperand = fir::getBase( converter.genExprValue(*Fortran::semantics::GetExpr(expr))); } else if (const auto &numThreadsClause = diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index 4588a95f2938..93f70e165f6b 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -155,8 +155,8 @@ TYPE_PARSER( TYPE_PARSER( "ACQUIRE" >> construct(construct()) || "ACQ_REL" >> construct(construct()) || -"ALIGNED" >> -construct(parenthesized(Parser{})) || +"ALIGNED" >> construct(construct( + parenthesized(Parser{}))) || "ALLOCATE" >> construct(construct( parenthesized(Parser{}))) || "ALLOCATOR" >> construct(construct( @@ -169,10 +169,10 @@ TYPE_PARSER( (parenthesized(Parser{} || "DEFAULT"_id >> construct(construct( parenthesized(Parser{}))) || -"DEFAULTMAP" >> -construct(parenthesized(Parser{})) || -"DEPEND" >> -construct(parenthesized(Parser{})) || +"DEFAULTMAP" >> construct(construct( +parenthesized(Parser{}))) || +"DEPEND" >> construct(construct( +parenthesized(Parser{}))) || "DEVICE" >> construct(construct( parenthesized(scalarIntExpr))) || "DIST_SCHEDULE" >> @@ -188,17 +188,19 @@ TYPE_PARSER( parenthesized(scalarIntExpr))) || "HINT" >> construct( construct(parenthesized(constantExpr))) || -"IF" >> construct(parenthesized(Parser{})) || +"IF" >> construct(construct( +parenthesized(Parser{}))) || "INBRANCH" >> construct(construct()) || "IS_DEVICE_PTR" >> construct(construct( parenthesized(nonemptyList(name || "LASTPRIVATE" >> construct(construct( parenthesized(Parser{}))) || -"LINEAR" >> -construct(parenthesized(Parser{})) || +"LINEAR" >> construct(construct( +parenthesized(Parser{}))) || "LINK" >> construct(construct( parenthesized(Parser{}))) || -"MAP" >> construct(parenthesized(Parser{})) || +"MAP" >> construct(construct( + parenthesized(Parser{}))) || "MERGEABLE" >> construct(construct()) || "NOGROUP" >> construct(construct()) || "NOTINBRANCH" >> @@ -227,8 +229,8 @@ TYPE_PARSER( "RELEASE" >> construct(construct()) || "SAFELEN" >> construct(construct( parenthesized(scalarIntConstantExpr))) || -"SCHEDULE" >> -construct(parenthesized(Parser{})) || +"SCHEDULE" >> construct(construct( + parenthesized(Parser{}))) || "SEQ_CST" >> construct(construct()) || "
[llvm-branch-commits] [llvm] 909d6c8 - [PowerPC] Fix the check for the instruction using FRSP/XSRSP output register
Author: Victor Huang Date: 2021-01-19T09:20:03-06:00 New Revision: 909d6c86eae32ef350ac35ba8564ed728544ac63 URL: https://github.com/llvm/llvm-project/commit/909d6c86eae32ef350ac35ba8564ed728544ac63 DIFF: https://github.com/llvm/llvm-project/commit/909d6c86eae32ef350ac35ba8564ed728544ac63.diff LOG: [PowerPC] Fix the check for the instruction using FRSP/XSRSP output register When performing peephole optimization to simplify the code, after removing passed FPSP/XSRSP instruction we will set any uses of that FRSP/XSRSP to the source of the FRSP/XSRSP. We are finding the machine instruction using virtual register holding FRSP/XSRSP results by searching all following instructions and encountering an issue that the first use of the virtual register is a debug MI causing: 1. virtual register in the debug MI removed unexpectedly. 2. virtual register used in non-debug MI not replaced with the source of FRSP/XSRSP. which stays in a undef status. This patch fix the issue by only searching non-debug machine instruction using virtual register holding FRSP/XSRSP results when the vr only has one non debug usage. Differential Revisien: https://reviews.llvm.org/D94711 Reviewed by: nemanjai Added: llvm/test/CodeGen/PowerPC/non-debug-mi-search-frspxsrsp.ll Modified: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp Removed: diff --git a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp index c28e09fc047e..c8b01aaef828 100644 --- a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp +++ b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp @@ -712,7 +712,7 @@ bool PPCMIPeephole::simplifyCode(void) { Simplified = true; Register ConvReg1 = RoundInstr->getOperand(1).getReg(); Register FRSPDefines = RoundInstr->getOperand(0).getReg(); - MachineInstr &Use = *(MRI->use_instr_begin(FRSPDefines)); + MachineInstr &Use = *(MRI->use_instr_nodbg_begin(FRSPDefines)); for (int i = 0, e = Use.getNumOperands(); i < e; ++i) if (Use.getOperand(i).isReg() && Use.getOperand(i).getReg() == FRSPDefines) diff --git a/llvm/test/CodeGen/PowerPC/non-debug-mi-search-frspxsrsp.ll b/llvm/test/CodeGen/PowerPC/non-debug-mi-search-frspxsrsp.ll new file mode 100644 index ..260fe19fbd41 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/non-debug-mi-search-frspxsrsp.ll @@ -0,0 +1,96 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s + +; Function Attrs: nounwind +define dso_local void @test(float* nocapture readonly %Fptr, <4 x float>* nocapture %Vptr) local_unnamed_addr #0 !dbg !10 { +; CHECK-LABEL: test: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: #DEBUG_VALUE: test:Fptr <- $x3 +; CHECK-NEXT: #DEBUG_VALUE: test:Vptr <- $x4 +; CHECK-NEXT: addis 5, 2, .LCPI0_0@toc@ha +; CHECK-NEXT: .Ltmp0: +; CHECK-NEXT: .loc1 2 38 prologue_end +; CHECK-NEXT: lfsx 0, 0, 3 +; CHECK-NEXT: addis 3, 2, .LCPI0_1@toc@ha +; CHECK-NEXT: .Ltmp1: +; CHECK-NEXT: #DEBUG_VALUE: test:Fptr <- $x3 +; CHECK-NEXT: .loc1 0 38 is_stmt 0 +; CHECK-NEXT: lfs 1, .LCPI0_0@toc@l(5) +; CHECK-NEXT: lfd 2, .LCPI0_1@toc@l(3) +; CHECK-NEXT: .loc1 2 27 +; CHECK-NEXT: xssubdp 1, 1, 0 +; CHECK-NEXT: .loc1 2 45 +; CHECK-NEXT: xsadddp 1, 1, 2 +; CHECK-NEXT: .Ltmp2: +; CHECK-NEXT: #DEBUG_VALUE: test:Val <- undef +; CHECK-NEXT: .loc1 0 45 +; CHECK-NEXT: xxlxor 2, 2, 2 +; CHECK-NEXT: .loc1 3 26 is_stmt 1 +; CHECK-NEXT: xxmrghd 0, 0, 2 +; CHECK-NEXT: xxmrghd 1, 2, 1 +; CHECK-NEXT: xvcvdpsp 34, 0 +; CHECK-NEXT: xvcvdpsp 35, 1 +; CHECK-NEXT: vmrgew 2, 2, 3 +; CHECK-NEXT: #DEBUG_VALUE: test:Vptr <- $x4 +; CHECK-NEXT: .loc1 3 9 is_stmt 0 +; CHECK-NEXT: stvx 2, 0, 4 +; CHECK-NEXT: .loc1 4 1 is_stmt 1 +; CHECK-NEXT: blr +entry: + call void @llvm.dbg.value(metadata float* %Fptr, metadata !19, metadata !DIExpression()), !dbg !22 + call void @llvm.dbg.value(metadata <4 x float>* %Vptr, metadata !20, metadata !DIExpression()), !dbg !22 + %0 = load float, float* %Fptr, align 4, !dbg !23, !tbaa !24 + %conv = fpext float %0 to double, !dbg !28 + %sub = fsub double 1.00e+00, %conv, !dbg !29 + %sub1 = fadd double %sub, -4.30e+00, !dbg !30 + %conv2 = fptrunc double %sub1 to float, !dbg !31 + call void @llvm.dbg.value(metadata float %conv2, metadata !21, metadata !DIExpression()), !dbg !22 + %vecinit4 = insertelement <4 x float> , float %conv2, i32 0, !dbg !32 + %vecinit5 = insertelement <4 x float> %vecinit4, float %0, i32 3, !dbg !32 + store <4 x float> %vecinit5, <4 x float>* %Vptr, align 16, !dbg !33, !tbaa !34 + ret vo
[llvm-branch-commits] [lldb] 480643a - [CMake] Remove dead code setting policies to NEW
Author: Raul Tambre Date: 2021-01-19T17:19:36+02:00 New Revision: 480643a95cd157e654f4f97e8231b18850e7d79a URL: https://github.com/llvm/llvm-project/commit/480643a95cd157e654f4f97e8231b18850e7d79a DIFF: https://github.com/llvm/llvm-project/commit/480643a95cd157e654f4f97e8231b18850e7d79a.diff LOG: [CMake] Remove dead code setting policies to NEW cmake_minimum_required(VERSION) calls cmake_policy(VERSION), which sets all policies up to VERSION to NEW. LLVM started requiring CMake 3.13 last year, so we can remove a bunch of code setting policies prior to 3.13 to NEW as it no longer has any effect. Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne Differential Revision: https://reviews.llvm.org/D94374 Added: Modified: clang/CMakeLists.txt compiler-rt/CMakeLists.txt flang/CMakeLists.txt libcxx/CMakeLists.txt libcxx/utils/ci/runtimes/CMakeLists.txt libcxxabi/CMakeLists.txt libunwind/CMakeLists.txt lldb/CMakeLists.txt llvm/CMakeLists.txt mlir/examples/standalone/CMakeLists.txt Removed: diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f1e5a39cfe05..9e74014134a0 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,9 +1,5 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - # If we are not building as a part of LLVM, build Clang as an # standalone project, using LLVM as an external library: if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 30302c2c1427..b44ad2c2118e 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -5,10 +5,6 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - # Check if compiler-rt is built as a standalone project. if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD) project(CompilerRT C CXX ASM) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 07d34354bd81..79aa53830d5e 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -1,20 +1,6 @@ cmake_minimum_required(VERSION 3.13.4) -# RPATH settings on macOS do not affect INSTALL_NAME. -if (POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -# Include file check macros honor CMAKE_REQUIRED_LIBRARIES. -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -# option() honors normal variables. -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON) option(FLANG_BUILD_NEW_DRIVER "Build the flang compiler driver" OFF) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index f4c7e9992f71..46a669500548 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -10,16 +10,7 @@ endif() #=== cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default -endif() -if(POLICY CMP0022) - cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang -endif() -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) # Add path for custom modules set(CMAKE_MODULE_PATH diff --git a/libcxx/utils/ci/runtimes/CMakeLists.txt b/libcxx/utils/ci/runtimes/CMakeLists.txt index 20980b530d4d..ab4182ae949e 100644 --- a/libcxx/utils/ci/runtimes/CMakeLists.txt +++ b/libcxx/utils/ci/runtimes/CMakeLists.txt @@ -1,20 +1,8 @@ cmake_minimum_required(VERSION 3.13.4) - -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - project(LLVM_RUNTIMES) +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) + find_package(Python3 COMPONENTS Interpreter) if(NOT Python3_Interpreter_FOUND) message(WARNING "Python3 not found, using python2 as a fallback") diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 146749f57b0a..c8ab9d7acb1d 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -10,10 +10,6 @@ endif() cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default -endif() - # Add path for custom modules set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index e344263173b0..8ae32fbccf4e 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -8,10 +8,6 @@ endif() cmake_minimum_required(VERSION 3.13.4) -
[llvm-branch-commits] [clang-tools-extra] 8bf7116 - [clangd] Index local classes, virtual and overriding methods.
Author: Utkarsh Saxena Date: 2021-01-19T16:18:48+01:00 New Revision: 8bf7116d50bfe8cb881273798ff384ed965c05e9 URL: https://github.com/llvm/llvm-project/commit/8bf7116d50bfe8cb881273798ff384ed965c05e9 DIFF: https://github.com/llvm/llvm-project/commit/8bf7116d50bfe8cb881273798ff384ed965c05e9.diff LOG: [clangd] Index local classes, virtual and overriding methods. Previously we did not record local class declarations. Now with features like findImplementation and typeHierarchy, we have a need to index such local classes to accurately report subclasses and implementations of methods. Performance testing results: - No changes in indexing timing. - No significant change in memory usage. - **1%** increase in #relations. - **0.17%** increase in #refs. - **0.22%** increase #symbols. **New index stats** Time to index: **4:13 min** memory usage **543MB** number of symbols: **521.5K** number of refs: **8679K** number of relations: **49K** **Base Index stats** Time to index: **4:15 min** memory usage **542MB** number of symbols: **520K** number of refs: **8664K** number of relations: **48.5K** Fixes: https://github.com/clangd/clangd/issues/644 Differential Revision: https://reviews.llvm.org/D94785 Added: Modified: clang-tools-extra/clangd/index/FileIndex.cpp clang-tools-extra/clangd/index/IndexAction.cpp clang-tools-extra/clangd/index/Serialization.cpp clang-tools-extra/clangd/index/SymbolCollector.cpp clang-tools-extra/clangd/index/SymbolCollector.h clang-tools-extra/clangd/test/index-serialization/Inputs/sample.idx clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp clang-tools-extra/clangd/unittests/XRefsTests.cpp Removed: diff --git a/clang-tools-extra/clangd/index/FileIndex.cpp b/clang-tools-extra/clangd/index/FileIndex.cpp index 143e76863777..26084c288674 100644 --- a/clang-tools-extra/clangd/index/FileIndex.cpp +++ b/clang-tools-extra/clangd/index/FileIndex.cpp @@ -61,7 +61,8 @@ SlabTuple indexSymbols(ASTContext &AST, std::shared_ptr PP, // We only need declarations, because we don't count references. IndexOpts.SystemSymbolFilter = index::IndexingOptions::SystemSymbolFilterKind::DeclarationsOnly; - IndexOpts.IndexFunctionLocals = false; + // We index function-local classes and its member functions only. + IndexOpts.IndexFunctionLocals = true; if (IsIndexMainAST) { // We only collect refs when indexing main AST. CollectorOpts.RefFilter = RefKind::All; diff --git a/clang-tools-extra/clangd/index/IndexAction.cpp b/clang-tools-extra/clangd/index/IndexAction.cpp index aa65008b51c0..e5a48df90b4d 100644 --- a/clang-tools-extra/clangd/index/IndexAction.cpp +++ b/clang-tools-extra/clangd/index/IndexAction.cpp @@ -212,6 +212,8 @@ std::unique_ptr createStaticIndexingAction( index::IndexingOptions IndexOpts; IndexOpts.SystemSymbolFilter = index::IndexingOptions::SystemSymbolFilterKind::All; + // We index function-local classes and its member functions only. + IndexOpts.IndexFunctionLocals = true; Opts.CollectIncludePath = true; if (Opts.Origin == SymbolOrigin::Unknown) Opts.Origin = SymbolOrigin::Static; diff --git a/clang-tools-extra/clangd/index/Serialization.cpp b/clang-tools-extra/clangd/index/Serialization.cpp index bba5eaa36754..ad1299aa1445 100644 --- a/clang-tools-extra/clangd/index/Serialization.cpp +++ b/clang-tools-extra/clangd/index/Serialization.cpp @@ -452,7 +452,7 @@ readCompileCommand(Reader CmdReader, llvm::ArrayRef Strings) { // The current versioning scheme is simple - non-current versions are rejected. // If you make a breaking change, bump this version number to invalidate stored // data. Later we may want to support some backward compatibility. -constexpr static uint32_t Version = 15; +constexpr static uint32_t Version = 16; llvm::Expected readRIFF(llvm::StringRef Data) { auto RIFF = riff::readFile(Data); diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index 20f2eacafb27..b1363c1f9cef 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -223,6 +223,11 @@ bool SymbolCollector::shouldCollectSymbol(const NamedDecl &ND, if (!IsMainFileOnly && ND.isInAnonymousNamespace()) return false; + // For function local symbols, index only classes and its member functions. + if (index::isFunctionLocalSymbol(&ND)) +return isa(ND) || + (ND.isCXXInstanceMember() && ND.isFunctionOrFunctionTemplate()); + // We want most things but not "local" symbols such as symbols inside // FunctionDecl, BlockDecl, ObjCMethodDecl and OMPDeclareReductionDecl. // FIXME: Need a matcher for ExportDecl in order to include symbols declared diff --git a/clang-tools-extra/clangd/index/Symbo
[llvm-branch-commits] [lld] 1a9b6e4 - [WebAssembly][lld] Fix call-indirect.s test to validate
Author: Andy Wingo Date: 2021-01-19T16:12:38+01:00 New Revision: 1a9b6e4a327f20189adde1129019c6652b818b43 URL: https://github.com/llvm/llvm-project/commit/1a9b6e4a327f20189adde1129019c6652b818b43 DIFF: https://github.com/llvm/llvm-project/commit/1a9b6e4a327f20189adde1129019c6652b818b43.diff LOG: [WebAssembly][lld] Fix call-indirect.s test to validate Add missing address operand, so that we can validate the output files. Depends on D92315. Differential Revision: https://reviews.llvm.org/D92320 Added: Modified: lld/test/wasm/Inputs/call-indirect.s lld/test/wasm/call-indirect.ll lld/test/wasm/compress-relocs.ll Removed: diff --git a/lld/test/wasm/Inputs/call-indirect.s b/lld/test/wasm/Inputs/call-indirect.s index c181aa19ad6b..57dbeec009d4 100644 --- a/lld/test/wasm/Inputs/call-indirect.s +++ b/lld/test/wasm/Inputs/call-indirect.s @@ -7,9 +7,11 @@ bar: .globl call_bar_indirect call_bar_indirect: .functype call_bar_indirect () -> () + i32.const 0 i32.load indirect_bar call_indirect () -> (i64) drop + i32.const 0 i32.load indirect_foo call_indirect () -> (i32) drop diff --git a/lld/test/wasm/call-indirect.ll b/lld/test/wasm/call-indirect.ll index d54647d67da1..08b4336c481d 100644 --- a/lld/test/wasm/call-indirect.ll +++ b/lld/test/wasm/call-indirect.ll @@ -122,7 +122,7 @@ define void @call_ptr(i64 (i64)* %arg) { ; CHECK-NEXT: Body:42010B ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Locals: -; CHECK-NEXT: Body: 2802808880800011808080800080808080001A2802848880800011818080800080808080001A0B +; CHECK-NEXT: Body: 41002802808880800011808080800080808080001A41002802848880800011818080800080808080001A0B ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Locals: ; CHECK-NEXT: Body:41020B diff --git a/lld/test/wasm/compress-relocs.ll b/lld/test/wasm/compress-relocs.ll index ccfc525d4b83..9285b080a3b5 100644 --- a/lld/test/wasm/compress-relocs.ll +++ b/lld/test/wasm/compress-relocs.ll @@ -22,5 +22,5 @@ entry: ; ERROR: wasm-ld: error: --compress-relocations is incompatible with output debug information. Please pass --strip-debug or --strip-all -; CHECK:Body: 2802808880800011808080800080808080001A2802848880800011818080800080808080001A0B -; COMPRESS: Body:28028008111A280284081101001A0B +; CHECK:Body: 41002802808880800011808080800080808080001A41002802848880800011818080800080808080001A0B +; COMPRESS: Body:410028028008111A4100280284081101001A0B ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 54e3844 - [ARM] Expand add.sat/sub.sat cost checks. NFC
Author: David Green Date: 2021-01-19T15:06:06Z New Revision: 54e38440e74f98ec58a22d7d8f9fc5e550ce65aa URL: https://github.com/llvm/llvm-project/commit/54e38440e74f98ec58a22d7d8f9fc5e550ce65aa DIFF: https://github.com/llvm/llvm-project/commit/54e38440e74f98ec58a22d7d8f9fc5e550ce65aa.diff LOG: [ARM] Expand add.sat/sub.sat cost checks. NFC Added: Modified: llvm/test/Analysis/CostModel/ARM/arith-ssat.ll llvm/test/Analysis/CostModel/ARM/arith-usat.ll Removed: diff --git a/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll b/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll index 66c99d804b26..13c1a148b249 100644 --- a/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll +++ b/llvm/test/Analysis/CostModel/ARM/arith-ssat.ll @@ -12,16 +12,22 @@ declare <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64>, <4 x i64>) declare <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64>, <8 x i64>) declare i32@llvm.sadd.sat.i32(i32, i32) +declare <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32>, <2 x i32>) declare <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32>, <4 x i32>) declare <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32>, <8 x i32>) declare <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32>, <16 x i32>) declare i16@llvm.sadd.sat.i16(i16, i16) +declare <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16>, <2 x i16>) +declare <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16>, <4 x i16>) declare <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16>, <8 x i16>) declare <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16>, <16 x i16>) declare <32 x i16> @llvm.sadd.sat.v32i16(<32 x i16>, <32 x i16>) declare i8 @llvm.sadd.sat.i8(i8, i8) +declare <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8>, <2 x i8>) +declare <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8>, <4 x i8>) +declare <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8>, <8 x i8>) declare <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8>, <16 x i8>) declare <32 x i8> @llvm.sadd.sat.v32i8(<32 x i8>, <32 x i8>) declare <64 x i8> @llvm.sadd.sat.v64i8(<64 x i8>, <64 x i8>) @@ -33,14 +39,20 @@ define i32 @add(i32 %arg) { ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V4I64 = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> undef, <4 x i64> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V8I64 = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> undef, <8 x i64> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %I32 = call i32 @llvm.sadd.sat.i32(i32 undef, i32 undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %V2I32 = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> undef, <2 x i32> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %V4I32 = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> undef, <4 x i32> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %V8I32 = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> undef, <8 x i32> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 288 for instruction: %V16I32 = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> undef, <16 x i32> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %I16 = call i16 @llvm.sadd.sat.i16(i16 undef, i16 undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %V2I16 = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> undef, <2 x i16> undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %V4I16 = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> undef, <4 x i16> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %V8I16 = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> undef, <8 x i16> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 288 for instruction: %V16I16 = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> undef, <16 x i16> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 576 for instruction: %V32I16 = call <32 x i16> @llvm.sadd.sat.v32i16(<32 x i16> undef, <32 x i16> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %I8 = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 36 for instruction: %V2I8 = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %V4I8 = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> undef, <4 x i8> undef) +; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %V8I8 = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> undef, <8 x i8> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 288 for instruction: %V16I8 = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> undef, <16 x i8> undef) ; V8M-RECIP-NEXT: Cost Model: Found an estimated cost of 576 for instruction
[llvm-branch-commits] [libcxx] 077a84f - [libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD
Author: Alex Richardson Date: 2021-01-19T15:02:57Z New Revision: 077a84f911403dc92d7918aebfb5611b6e0677d2 URL: https://github.com/llvm/llvm-project/commit/077a84f911403dc92d7918aebfb5611b6e0677d2 DIFF: https://github.com/llvm/llvm-project/commit/077a84f911403dc92d7918aebfb5611b6e0677d2.diff LOG: [libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD Commit 5e416ba943b7c737deb8eca62756f7b4fa925845 (D71522) updated the __config header but didn't change test_macros.h. This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on FreeBSD12/13. Reviewed By: #libc, dim, ldionne Differential Revision: https://reviews.llvm.org/D94292 Added: Modified: libcxx/test/support/test_macros.h Removed: diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 5f8ac2e8b8aa..b71d73980062 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -167,8 +167,10 @@ // This is cribbed from __config; but lives here as well because we can't assume libc++ #if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11 # if defined(__FreeBSD__) -// Specifically, FreeBSD does NOT have timespec_get, even though they have all -// the rest of C11 - this is PR#38495 +#if __FreeBSD_version >= 1300064 || \ + (__FreeBSD_version >= 1201504 && __FreeBSD_version < 130) +# define TEST_HAS_TIMESPEC_GET +#endif #define TEST_HAS_ALIGNED_ALLOC #define TEST_HAS_QUICK_EXIT # elif defined(__BIONIC__) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3747b69 - [LoopRotate] Calls not lowered to calls should not block rotation.
Author: Florian Hahn Date: 2021-01-19T14:37:36Z New Revision: 3747b69b531299f7a2a0289b8a59ac7234e47d4f URL: https://github.com/llvm/llvm-project/commit/3747b69b531299f7a2a0289b8a59ac7234e47d4f DIFF: https://github.com/llvm/llvm-project/commit/3747b69b531299f7a2a0289b8a59ac7234e47d4f.diff LOG: [LoopRotate] Calls not lowered to calls should not block rotation. 83daa49758a1 made loop-rotate more conservative in the presence of function calls in the prepare-for-lto stage. The code did not properly account for calls that are no actual function calls, like calls to intrinsics. This patch updates the code to ensure only calls that are lowered to actual calls are considered inline candidates. Added: Modified: llvm/lib/Analysis/CodeMetrics.cpp llvm/test/Transforms/LoopRotate/call-prepare-for-lto.ll Removed: diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp index fca62c1521d5..157811c04eb5 100644 --- a/llvm/lib/Analysis/CodeMetrics.cpp +++ b/llvm/lib/Analysis/CodeMetrics.cpp @@ -125,12 +125,13 @@ void CodeMetrics::analyzeBasicBlock( // Special handling for calls. if (const auto *Call = dyn_cast(&I)) { if (const Function *F = Call->getCalledFunction()) { +bool IsLoweredToCall = TTI.isLoweredToCall(F); // If a function is both internal and has a single use, then it is // extremely likely to get inlined in the future (it was probably // exposed by an interleaved devirtualization pass). // When preparing for LTO, liberally consider calls as inline // candidates. -if (!Call->isNoInline() && +if (!Call->isNoInline() && IsLoweredToCall && ((F->hasInternalLinkage() && F->hasOneUse()) || PrepareForLTO)) { ++NumInlineCandidates; } @@ -142,7 +143,7 @@ void CodeMetrics::analyzeBasicBlock( if (F == BB->getParent()) isRecursive = true; -if (TTI.isLoweredToCall(F)) +if (IsLoweredToCall) ++NumCalls; } else { // We don't want inline asm to count as a call - that would prevent loop diff --git a/llvm/test/Transforms/LoopRotate/call-prepare-for-lto.ll b/llvm/test/Transforms/LoopRotate/call-prepare-for-lto.ll index 0f98e41c9ba4..4a84b761d912 100644 --- a/llvm/test/Transforms/LoopRotate/call-prepare-for-lto.ll +++ b/llvm/test/Transforms/LoopRotate/call-prepare-for-lto.ll @@ -41,3 +41,61 @@ for.end: ; preds = %for.cond define void @may_be_inlined() { ret void } + +; Intrinsics, like @llvm.dbg.value are never inlined and should not block loop +; rotation, even when preparing for LTO. +define void @test_prepare_for_lto_intrinsic() !dbg !7 { +; FULL-LABEL: @test_prepare_for_lto_intrinsic( +; FULL-NEXT: entry: +; FULL-NEXT:%array = alloca [20 x i32], align 16 +; FULL-NEXT:call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !DIExpression()), !dbg !13 +; FULL-NEXT:%arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0 +; FULL-NEXT:br label %for.body +; +; PREPARE-LABEL: @test_prepare_for_lto_intrinsic( +; PREPARE-NEXT: entry: +; PREPARE-NEXT:%array = alloca [20 x i32], align 16 +; PREPARE-NEXT:call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !DIExpression()), !dbg !13 +; PREPARE-NEXT:%arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0 +; PREPARE-NEXT:br label %for.body +; +entry: + %array = alloca [20 x i32], align 16 + br label %for.cond + +for.cond: ; preds = %for.body, %entry + %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + call void @llvm.dbg.value(metadata i32 %i.0, metadata !12, metadata !DIExpression()), !dbg !13 + %cmp = icmp slt i32 %i.0, 100 + %arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + store i32 0, i32* %arrayidx, align 16 + %inc = add nsw i32 %i.0, 1 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +declare void @llvm.dbg.value(metadata, metadata, metadata) #2 + + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5, !6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: "test.c", directory: "/tmp") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{i32 7, !"PIC Level", i32 2} +!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, uni
[llvm-branch-commits] [flang] c42f5ca - [Flang][OpenMP] Add semantic checks for OpenMP Workshare Construct
Author: Praveen Date: 2021-01-19T20:00:12+05:30 New Revision: c42f5ca3d84c7b0d4e735ab3794718c429369309 URL: https://github.com/llvm/llvm-project/commit/c42f5ca3d84c7b0d4e735ab3794718c429369309 DIFF: https://github.com/llvm/llvm-project/commit/c42f5ca3d84c7b0d4e735ab3794718c429369309.diff LOG: [Flang][OpenMP] Add semantic checks for OpenMP Workshare Construct Add Semantic checks for OpenMP 4.5 - 2.7.4 Workshare Construct. - The structured block in a workshare construct may consist of only scalar or array assignments, forall or where statements, forall, where, atomic, critical or parallel constructs. - All array assignments, scalar assignments, and masked array assignments must be intrinsic assignments. - The construct must not contain any user defined function calls unless the function is ELEMENTAL. Test cases : omp-workshare03.f90, omp-workshare04.f90, omp-workshare05.f90 Resolve test cases (omp-workshare01.f90 and omp-workshare02.f90) marked as XFAIL Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D93091 Added: flang/test/Semantics/omp-workshare03.f90 flang/test/Semantics/omp-workshare04.f90 flang/test/Semantics/omp-workshare05.f90 Modified: flang/lib/Semantics/check-omp-structure.cpp flang/lib/Semantics/check-omp-structure.h flang/test/Semantics/omp-workshare01.f90 flang/test/Semantics/omp-workshare02.f90 Removed: diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index ff0db2c5182c..a9064490c352 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -37,6 +37,53 @@ namespace Fortran::semantics { CheckAllowed(llvm::omp::Y); \ } +// 'OmpWorkshareBlockChecker' is used to check the validity of the assignment +// statements and the expressions enclosed in an OpenMP Workshare construct +class OmpWorkshareBlockChecker { +public: + OmpWorkshareBlockChecker(SemanticsContext &context, parser::CharBlock source) + : context_{context}, source_{source} {} + + template bool Pre(const T &) { return true; } + template void Post(const T &) {} + + bool Pre(const parser::AssignmentStmt &assignment) { +const auto &var{std::get(assignment.t)}; +const auto &expr{std::get(assignment.t)}; +const auto *lhs{GetExpr(var)}; +const auto *rhs{GetExpr(expr)}; +Tristate isDefined{semantics::IsDefinedAssignment( +lhs->GetType(), lhs->Rank(), rhs->GetType(), rhs->Rank())}; +if (isDefined == Tristate::Yes) { + context_.Say(expr.source, + "Defined assignment statement is not " + "allowed in a WORKSHARE construct"_err_en_US); +} +return true; + } + + bool Pre(const parser::Expr &expr) { +if (const auto *e{GetExpr(expr)}) { + for (const Symbol &symbol : evaluate::CollectSymbols(*e)) { +const Symbol &root{GetAssociationRoot(symbol)}; +if (IsFunction(root) && +!(root.attrs().test(Attr::ELEMENTAL) || +root.attrs().test(Attr::INTRINSIC))) { + context_.Say(expr.source, + "User defined non-ELEMENTAL function " + "'%s' is not allowed in a WORKSHARE construct"_err_en_US, + root.name()); +} + } +} +return false; + } + +private: + SemanticsContext &context_; + parser::CharBlock source_; +}; + bool OmpStructureChecker::HasInvalidWorksharingNesting( const parser::CharBlock &source, const OmpDirectiveSet &set) { // set contains all the invalid closely nested directives @@ -149,6 +196,15 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) { PushContextAndClauseSets(beginDir.source, beginDir.v); CheckNoBranching(block, beginDir.v, beginDir.source); + + switch (beginDir.v) { + case llvm::omp::OMPD_workshare: + case llvm::omp::OMPD_parallel_workshare: +CheckWorkshareBlockStmts(block, beginDir.source); +break; + default: +break; + } } void OmpStructureChecker::Leave(const parser::OpenMPBlockConstruct &) { @@ -835,4 +891,82 @@ void OmpStructureChecker::GetSymbolsInObjectList( } } +void OmpStructureChecker::CheckWorkshareBlockStmts( +const parser::Block &block, parser::CharBlock source) { + OmpWorkshareBlockChecker ompWorkshareBlockChecker{context_, source}; + + for (auto it{block.begin()}; it != block.end(); ++it) { +if (parser::Unwrap(*it) || +parser::Unwrap(*it) || +parser::Unwrap(*it) || +parser::Unwrap(*it) || +parser::Unwrap(*it)) { + parser::Walk(*it, ompWorkshareBlockChecker); +} else if (const auto *ompConstruct{ + parser::Unwrap(*it)}) { + if (const auto *ompAtomicConstruct{ + std::get_if(&ompConstruct->u)}) { +// Check if assignment statements in the enclosing OpenMP Atomic +// construct are
[llvm-branch-commits] [llvm] 2988f94 - [X86] Regenerate fmin/fmax reduction tests
Author: Simon Pilgrim Date: 2021-01-19T14:28:44Z New Revision: 2988f940d861f0fa76bc5b749772f2b9239d5a1b URL: https://github.com/llvm/llvm-project/commit/2988f940d861f0fa76bc5b749772f2b9239d5a1b DIFF: https://github.com/llvm/llvm-project/commit/2988f940d861f0fa76bc5b749772f2b9239d5a1b.diff LOG: [X86] Regenerate fmin/fmax reduction tests Add missing check-prefixes + v1f32 tests Added: Modified: llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll llvm/test/CodeGen/X86/vector-reduce-fmax.ll llvm/test/CodeGen/X86/vector-reduce-fmin-nnan.ll llvm/test/CodeGen/X86/vector-reduce-fmin.ll Removed: diff --git a/llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll b/llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll index 021c48deece7..167248181ecb 100644 --- a/llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll +++ b/llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll @@ -1,15 +1,23 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=AVX -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=AVX512 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefix=AVX512 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=ALL,SSE,SSE2 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=ALL,SSE,SSE41 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=ALL,AVX +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=ALL,AVX +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=ALL,AVX512 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefixes=ALL,AVX512 ; ; vXf32 ; +define float @test_v1f32(<1 x float> %a0) { +; ALL-LABEL: test_v1f32: +; ALL: # %bb.0: +; ALL-NEXT:retq + %1 = call nnan float @llvm.vector.reduce.fmax.v1f32(<1 x float> %a0) + ret float %1 +} + define float @test_v2f32(<2 x float> %a0) { ; SSE2-LABEL: test_v2f32: ; SSE2: # %bb.0: @@ -458,10 +466,10 @@ define half @test_v2f16(<2 x half> %a0) nounwind { ; SSE-NEXT:subq $16, %rsp ; SSE-NEXT:movl %edi, %ebx ; SSE-NEXT:movzwl %si, %edi -; SSE-NEXT:callq __gnu_h2f_ieee +; SSE-NEXT:callq __gnu_h2f_ieee@PLT ; SSE-NEXT:movaps %xmm0, (%rsp) # 16-byte Spill ; SSE-NEXT:movzwl %bx, %edi -; SSE-NEXT:callq __gnu_h2f_ieee +; SSE-NEXT:callq __gnu_h2f_ieee@PLT ; SSE-NEXT:movaps %xmm0, %xmm1 ; SSE-NEXT:cmpunordss %xmm0, %xmm1 ; SSE-NEXT:movaps %xmm1, %xmm2 @@ -471,7 +479,7 @@ define half @test_v2f16(<2 x half> %a0) nounwind { ; SSE-NEXT:andnps %xmm3, %xmm1 ; SSE-NEXT:orps %xmm2, %xmm1 ; SSE-NEXT:movaps %xmm1, %xmm0 -; SSE-NEXT:callq __gnu_f2h_ieee +; SSE-NEXT:callq __gnu_f2h_ieee@PLT ; SSE-NEXT:addq $16, %rsp ; SSE-NEXT:popq %rbx ; SSE-NEXT:retq @@ -482,16 +490,16 @@ define half @test_v2f16(<2 x half> %a0) nounwind { ; AVX-NEXT:subq $16, %rsp ; AVX-NEXT:movl %esi, %ebx ; AVX-NEXT:movzwl %di, %edi -; AVX-NEXT:callq __gnu_h2f_ieee +; AVX-NEXT:callq __gnu_h2f_ieee@PLT ; AVX-NEXT:vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill ; AVX-NEXT:movzwl %bx, %edi -; AVX-NEXT:callq __gnu_h2f_ieee +; AVX-NEXT:callq __gnu_h2f_ieee@PLT ; AVX-NEXT:vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Reload ; AVX-NEXT:# xmm2 = mem[0],zero,zero,zero ; AVX-NEXT:vmaxss %xmm2, %xmm0, %xmm1 ; AVX-NEXT:vcmpunordss %xmm2, %xmm2, %xmm2 ; AVX-NEXT:vblendvps %xmm2, %xmm0, %xmm1, %xmm0 -; AVX-NEXT:callq __gnu_f2h_ieee +; AVX-NEXT:callq __gnu_f2h_ieee@PLT ; AVX-NEXT:addq $16, %rsp ; AVX-NEXT:popq %rbx ; AVX-NEXT:retq @@ -514,6 +522,7 @@ define half @test_v2f16(<2 x half> %a0) nounwind { %1 = call nnan half @llvm.vector.reduce.fmax.v2f16(<2 x half> %a0) ret half %1 } +declare float @llvm.vector.reduce.fmax.v1f32(<1 x float>) declare float @llvm.vector.reduce.fmax.v2f32(<2 x float>) declare float @llvm.vector.reduce.fmax.v4f32(<4 x float>) declare float @llvm.vector.reduce.fmax.v8f32(<8 x float>) diff --git a/llvm/test/CodeGen/X86/vector-reduce-fmax.ll b/llvm/test/CodeGen/X86/vector-reduce-fmax.ll index af8141a119ab..d7d754ac5548 100644 --- a/llvm/test/CodeGen/X86/vector-reduce-fmax.
[llvm-branch-commits] [lldb] 626681b - [lldb] Fix two documentation typos
Author: Raphael Isemann Date: 2021-01-19T15:25:15+01:00 New Revision: 626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc URL: https://github.com/llvm/llvm-project/commit/626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc DIFF: https://github.com/llvm/llvm-project/commit/626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc.diff LOG: [lldb] Fix two documentation typos Added: Modified: lldb/bindings/interface/SBListener.i lldb/include/lldb/lldb-enumerations.h Removed: diff --git a/lldb/bindings/interface/SBListener.i b/lldb/bindings/interface/SBListener.i index 63474b3335fb..9062e7534423 100644 --- a/lldb/bindings/interface/SBListener.i +++ b/lldb/bindings/interface/SBListener.i @@ -11,7 +11,7 @@ namespace lldb { %feature("docstring", "API clients can register its own listener to debugger events. -See aslo :py:class:`SBEvent` for example usage of creating and adding a listener." +See also :py:class:`SBEvent` for example usage of creating and adding a listener." ) SBListener; class SBListener { diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index ff4e15e7e070..cb78ff29e557 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -971,7 +971,7 @@ enum GdbSignal { eGdbSignalBreakpoint = 0x96 }; -/// Used with SBHost::GetPath (lldb::PathType) to find files that are +/// Used with SBHostOS::GetLLDBPath (lldb::PathType) to find files that are /// related to LLDB on the current host machine. Most files are /// relative to LLDB or are in known locations. enum PathType { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 3a56a96 - [mlir][spirv] Define spv.GLSL.Fma and add lowerings
Author: Lei Zhang Date: 2021-01-19T09:14:21-05:00 New Revision: 3a56a96664de955888d63c49a33808e3a1a294d9 URL: https://github.com/llvm/llvm-project/commit/3a56a96664de955888d63c49a33808e3a1a294d9 DIFF: https://github.com/llvm/llvm-project/commit/3a56a96664de955888d63c49a33808e3a1a294d9.diff LOG: [mlir][spirv] Define spv.GLSL.Fma and add lowerings Also changes some rewriter.create + rewriter.replaceOp calls into rewriter.replaceOpWithNewOp calls. Reviewed By: hanchung Differential Revision: https://reviews.llvm.org/D94965 Added: Modified: mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp mlir/test/Conversion/VectorToSPIRV/simple.mlir mlir/test/Dialect/SPIRV/IR/glsl-ops.mlir mlir/test/Target/SPIRV/glsl-ops.mlir Removed: diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td index a566b7503a15..c34cd98dbb39 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td @@ -972,4 +972,44 @@ def SPV_GLSLSClampOp : SPV_GLSLTernaryArithmeticOp<"SClamp", 45, SPV_SignedInt> }]; } +// - + +def SPV_GLSLFmaOp : SPV_GLSLTernaryArithmeticOp<"Fma", 50, SPV_Float> { + let summary = "Computes a * b + c."; + + let description = [{ +In uses where this operation is decorated with NoContraction: + +- fma is considered a single operation, whereas the expression a * b + c + is considered two operations. +- The precision of fma can diff er from the precision of the expression + a * b + c. +- fma will be computed with the same precision as any other fma decorated + with NoContraction, giving invariant results for the same input values + of a, b, and c. + +Otherwise, in the absence of a NoContraction decoration, there are no +special constraints on the number of operations or diff erence in precision +between fma and the expression a * b +c. + +The operands must all be a scalar or vector whose component type is +floating-point. + +Result Type and the type of all operands must be the same type. Results +are computed per component. + + +``` +fma-op ::= ssa-id `=` `spv.GLSL.Fma` ssa-use, ssa-use, ssa-use `:` + float-scalar-vector-type +``` + Example: + +```mlir +%0 = spv.GLSL.Fma %a, %b, %c : f32 +%1 = spv.GLSL.Fma %a, %b, %c : vector<3xf16> +``` + }]; +} + #endif // MLIR_DIALECT_SPIRV_IR_GLSL_OPS diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp index 1509836ef2e2..52a35a17869f 100644 --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -36,9 +36,8 @@ struct VectorBroadcastConvert final vector::BroadcastOp::Adaptor adaptor(operands); SmallVector source(broadcastOp.getVectorType().getNumElements(), adaptor.source()); -Value construct = rewriter.create( -broadcastOp.getLoc(), broadcastOp.getVectorType(), source); -rewriter.replaceOp(broadcastOp, construct); +rewriter.replaceOpWithNewOp( +broadcastOp, broadcastOp.getVectorType(), source); return success(); } }; @@ -55,9 +54,23 @@ struct VectorExtractOpConvert final return failure(); vector::ExtractOp::Adaptor adaptor(operands); int32_t id = extractOp.position().begin()->cast().getInt(); -Value newExtract = rewriter.create( -extractOp.getLoc(), adaptor.vector(), id); -rewriter.replaceOp(extractOp, newExtract); +rewriter.replaceOpWithNewOp( +extractOp, adaptor.vector(), id); +return success(); + } +}; + +struct VectorFmaOpConvert final : public OpConversionPattern { + using OpConversionPattern::OpConversionPattern; + + LogicalResult + matchAndRewrite(vector::FMAOp fmaOp, ArrayRef operands, + ConversionPatternRewriter &rewriter) const override { +if (!spirv::CompositeType::isValid(fmaOp.getVectorType())) + return failure(); +vector::FMAOp::Adaptor adaptor(operands); +rewriter.replaceOpWithNewOp( +fmaOp, fmaOp.getType(), adaptor.lhs(), adaptor.rhs(), adaptor.acc()); return success(); } }; @@ -74,9 +87,8 @@ struct VectorInsertOpConvert final return failure(); vector::InsertOp::Adaptor adaptor(operands); int32_t id = insertOp.position().begin()->cast().getInt(); -Value newInsert = rewriter.create( -insertOp.getLoc(), adaptor.source(), adaptor.dest(), id); -rewriter.replaceOp(insertOp, newInsert); +rewriter.replaceOpWithNewOp( +insertOp, adaptor.source(), adaptor.dest(), id); return success(); } }; @@ -92,10 +104,9 @@ struct VectorExtractElementOpConvert final if (!spirv::CompositeType::isVa
[llvm-branch-commits] [mlir] 93a873d - [mlir][Affine] Revisit and simplify composeAffineMapAndOperands.
Author: Nicolas Vasilache Date: 2021-01-19T13:52:07Z New Revision: 93a873dfc9ee7e8b4386dea87e43c5f238eeef06 URL: https://github.com/llvm/llvm-project/commit/93a873dfc9ee7e8b4386dea87e43c5f238eeef06 DIFF: https://github.com/llvm/llvm-project/commit/93a873dfc9ee7e8b4386dea87e43c5f238eeef06.diff LOG: [mlir][Affine] Revisit and simplify composeAffineMapAndOperands. In prehistorical times, AffineApplyOp was allowed to produce multiple values. This allowed the creation of intricate SSA use-def chains. AffineApplyNormalizer was originally introduced as a means of reusing the AffineMap::compose method to write SSA use-def chains. Unfortunately, symbols that were produced by an AffineApplyOp needed to be promoted to dims and reordered for the mathematical composition to be valid. Since then, single result AffineApplyOp became the law of the land but the original assumptions were not revisited. This revision revisits these assumptions and retires AffineApplyNormalizer. Differential Revision: https://reviews.llvm.org/D94920 Added: Modified: mlir/include/mlir/Dialect/Affine/IR/AffineOps.h mlir/include/mlir/IR/AffineExpr.h mlir/include/mlir/IR/AffineMap.h mlir/lib/Dialect/Affine/IR/AffineOps.cpp mlir/lib/Dialect/Affine/IR/AffineValueMap.cpp mlir/lib/IR/AffineExpr.cpp mlir/lib/IR/AffineMap.cpp mlir/test/Dialect/Affine/affine-data-copy.mlir mlir/test/Dialect/Affine/canonicalize.mlir mlir/test/Dialect/Linalg/reshape_fusion.mlir mlir/test/EDSC/builder-api-test.cpp mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp Removed: mlir/test/Dialect/Affine/SuperVectorize/normalize_maps.mlir diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h index b097f18e8cea..9b30c9b160b7 100644 --- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h +++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h @@ -439,81 +439,6 @@ class AffineBound { friend class AffineForOp; }; -/// An `AffineApplyNormalizer` is a helper class that supports renumbering -/// operands of AffineApplyOp. This acts as a reindexing map of Value to -/// positional dims or symbols and allows simplifications such as: -/// -/// ```mlir -///%1 = affine.apply (d0, d1) -> (d0 - d1) (%0, %0) -/// ``` -/// -/// into: -/// -/// ```mlir -///%1 = affine.apply () -> (0) -/// ``` -struct AffineApplyNormalizer { - AffineApplyNormalizer(AffineMap map, ArrayRef operands); - - /// Returns the AffineMap resulting from normalization. - AffineMap getAffineMap() { return affineMap; } - - SmallVector getOperands() { -SmallVector res(reorderedDims); -res.append(concatenatedSymbols.begin(), concatenatedSymbols.end()); -return res; - } - - unsigned getNumSymbols() { return concatenatedSymbols.size(); } - unsigned getNumDims() { return reorderedDims.size(); } - - /// Normalizes 'otherMap' and its operands 'otherOperands' to map to this - /// normalizer's coordinate space. - void normalize(AffineMap *otherMap, SmallVectorImpl *otherOperands); - -private: - /// Helper function to insert `v` into the coordinate system of the current - /// AffineApplyNormalizer. Returns the AffineDimExpr with the corresponding - /// renumbered position. - AffineDimExpr renumberOneDim(Value v); - - /// Given an `other` normalizer, this rewrites `other.affineMap` in the - /// coordinate system of the current AffineApplyNormalizer. - /// Returns the rewritten AffineMap and updates the dims and symbols of - /// `this`. - AffineMap renumber(const AffineApplyNormalizer &other); - - /// Maps of Value to position in `affineMap`. - DenseMap dimValueToPosition; - - /// Ordered dims and symbols matching positional dims and symbols in - /// `affineMap`. - SmallVector reorderedDims; - SmallVector concatenatedSymbols; - - /// The number of symbols in concatenated symbols that belong to the original - /// map as opposed to those concatendated during map composition. - unsigned numProperSymbols; - - AffineMap affineMap; - - /// Used with RAII to control the depth at which AffineApply are composed - /// recursively. Only accepts depth 1 for now to allow a behavior where a - /// newly composed AffineApplyOp does not increase the length of the chain of - /// AffineApplyOps. Full composition is implemented iteratively on top of - /// this behavior. - static unsigned &affineApplyDepth() { -static thread_local unsigned depth = 0; -return depth; - } - static constexpr unsigned kMaxAffineApplyDepth = 1; - - AffineApplyNormalizer() : numProperSymbols(0) { affineApplyDepth()++; } - -public: - ~AffineApplyNormalizer() { affineApplyDepth()--; } -}; - } // end namespace mlir #endif diff --git a/mlir/include/mlir/IR/AffineExpr.h b/mlir/include/mlir/IR/AffineExpr.h index d4f7de501a95..3e4e1c014b58 100644 --- a/mlir/include/mlir/IR/AffineExpr.h +++ b/mlir/i
[llvm-branch-commits] [llvm] 6259fbd - AArch64: add apple-a14 as a CPU
Author: Tim Northover Date: 2021-01-19T14:04:53Z New Revision: 6259fbd8b69531133d24b5367a6a2cd9b183ce48 URL: https://github.com/llvm/llvm-project/commit/6259fbd8b69531133d24b5367a6a2cd9b183ce48 DIFF: https://github.com/llvm/llvm-project/commit/6259fbd8b69531133d24b5367a6a2cd9b183ce48.diff LOG: AArch64: add apple-a14 as a CPU This CPU supports all v8.5a features except BTI, and so identifies as v8.5a to Clang. A bit weird, but the best way for things like xnu to detect the new features it cares about. Added: Modified: llvm/include/llvm/Support/AArch64TargetParser.def llvm/lib/Target/AArch64/AArch64.td llvm/lib/Target/AArch64/AArch64Subtarget.cpp llvm/lib/Target/AArch64/AArch64Subtarget.h llvm/unittests/Support/TargetParserTest.cpp Removed: diff --git a/llvm/include/llvm/Support/AArch64TargetParser.def b/llvm/include/llvm/Support/AArch64TargetParser.def index 5f36b0eecff9..332fb555e824 100644 --- a/llvm/include/llvm/Support/AArch64TargetParser.def +++ b/llvm/include/llvm/Support/AArch64TargetParser.def @@ -189,6 +189,8 @@ AARCH64_CPU_NAME("apple-a12", ARMV8_3A, FK_CRYPTO_NEON_FP_ARMV8, false, (AArch64::AEK_FP16)) AARCH64_CPU_NAME("apple-a13", ARMV8_4A, FK_CRYPTO_NEON_FP_ARMV8, false, (AArch64::AEK_FP16 | AArch64::AEK_FP16FML)) +AARCH64_CPU_NAME("apple-a14", ARMV8_5A, FK_CRYPTO_NEON_FP_ARMV8, false, + (AArch64::AEK_FP16 | AArch64::AEK_FP16FML)) AARCH64_CPU_NAME("apple-s4", ARMV8_3A, FK_CRYPTO_NEON_FP_ARMV8, false, (AArch64::AEK_FP16)) AARCH64_CPU_NAME("apple-s5", ARMV8_3A, FK_CRYPTO_NEON_FP_ARMV8, false, diff --git a/llvm/lib/Target/AArch64/AArch64.td b/llvm/lib/Target/AArch64/AArch64.td index 165939e6252b..15c7130b24f3 100644 --- a/llvm/lib/Target/AArch64/AArch64.td +++ b/llvm/lib/Target/AArch64/AArch64.td @@ -854,6 +854,38 @@ def ProcAppleA13 : SubtargetFeature<"apple-a13", "ARMProcFamily", "AppleA13", HasV8_4aOps ]>; +def ProcAppleA14 : SubtargetFeature<"apple-a14", "ARMProcFamily", "AppleA14", + "Apple A14", [ + FeatureAggressiveFMA, + FeatureAlternateSExtLoadCVTF32Pattern, + FeatureAltFPCmp, + FeatureArithmeticBccFusion, + FeatureArithmeticCbzFusion, + FeatureCrypto, + FeatureDisableLatencySchedHeuristic, + FeatureFPARMv8, + FeatureFRInt3264, + FeatureFuseAddress, + FeatureFuseAES, + FeatureFuseArithmeticLogic, + FeatureFuseCCSelect, + FeatureFuseCryptoEOR, + FeatureFuseLiterals, + FeatureNEON, + FeaturePerfMon, + FeatureSpecRestrict, + FeatureSSBS, + FeatureSB, + FeaturePredRes, + FeatureCacheDeepPersist, + FeatureZCRegMove, + FeatureZCZeroing, + FeatureFullFP16, + FeatureFP16FML, + FeatureSHA3, + HasV8_4aOps + ]>; + def ProcExynosM3 : SubtargetFeature<"exynosm3", "ARMProcFamily", "ExynosM3", "Samsung Exynos-M3 processors", [FeatureCRC, @@ -1147,6 +1179,7 @@ def : ProcessorModel<"apple-a10", CycloneModel, [ProcAppleA10]>; def : ProcessorModel<"apple-a11", CycloneModel, [ProcAppleA11]>; def : ProcessorModel<"apple-a12", CycloneModel, [ProcAppleA12]>; def : ProcessorModel<"apple-a13", CycloneModel, [ProcAppleA13]>; +def : ProcessorModel<"apple-a14", CycloneModel, [ProcAppleA14]>; // watch CPUs. def : ProcessorModel<"apple-s4", CycloneModel, [ProcAppleA12]>; diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index 2a4a5954e4b6..71b2bb196486 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -122,6 +122,7 @@ void AArch64Subtarget::initializeProperties() { case AppleA11: case AppleA12: case AppleA13: + case AppleA14: CacheLineSize = 64; PrefetchDistance =
[llvm-branch-commits] [llvm] ec87710 - [ThinLTO] Also prune Thin-* files from the ThinLTO cache
Author: Hans Wennborg Date: 2021-01-19T14:43:49+01:00 New Revision: ec877106a38b760229a2d676b7d2278b2bade8ab URL: https://github.com/llvm/llvm-project/commit/ec877106a38b760229a2d676b7d2278b2bade8ab DIFF: https://github.com/llvm/llvm-project/commit/ec877106a38b760229a2d676b7d2278b2bade8ab.diff LOG: [ThinLTO] Also prune Thin-* files from the ThinLTO cache Such files (Thin-%%.tmp.o) are supposed to be deleted immediately after they're used (either by renaming or deletion). However, we've seen instances on Windows where this doesn't happen, probably due to the filesystem being flaky. This is effectively a resource leak which has prevented us from using the ThinLTO cache on Windows. Since those temporary files are in the thinlto cache directory which we prune periodically anyway, allowing them to be pruned too seems like a tidy way to solve the problem. Differential revision: https://reviews.llvm.org/D94962 Added: Modified: lld/test/COFF/lto-cache.ll llvm/lib/Support/CachePruning.cpp Removed: diff --git a/lld/test/COFF/lto-cache.ll b/lld/test/COFF/lto-cache.ll index ced0c5251d13..559f7a9db91e 100644 --- a/lld/test/COFF/lto-cache.ll +++ b/lld/test/COFF/lto-cache.ll @@ -7,8 +7,8 @@ ; RUN: rm -Rf %t.cache && mkdir %t.cache ; Create two files that would be removed by cache pruning due to age. -; We should only remove files matching the pattern "llvmcache-*". -; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo +; We should only remove files matching "llvmcache-*" or "Thin-*". +; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/Thin-123.tmp.o %t.cache/foo ; RUN: lld-link /lldltocache:%t.cache /lldltocachepolicy:prune_after=1h /out:%t3 /entry:main %t2.o %t.o ; Two cached objects, plus a timestamp file and "foo", minus the file we removed. diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp index 7663644db558..5c5759ffbaca 100644 --- a/llvm/lib/Support/CachePruning.cpp +++ b/llvm/lib/Support/CachePruning.cpp @@ -211,11 +211,12 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) { // Walk all of the files within this directory. for (sys::fs::directory_iterator File(CachePathNative, EC), FileEnd; File != FileEnd && !EC; File.increment(EC)) { -// Ignore any files not beginning with the string "llvmcache-". This +// Ignore filenames not beginning with "llvmcache-" or "Thin-". This // includes the timestamp file as well as any files created by the user. // This acts as a safeguard against data loss if the user specifies the // wrong directory as their cache directory. -if (!sys::path::filename(File->path()).startswith("llvmcache-")) +StringRef filename = sys::path::filename(File->path()); +if (!filename.startswith("llvmcache-") && !filename.startswith("Thin-")) continue; // Look at this file. If we can't stat it, there's nothing interesting ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 1d37db6 - [llvm/Orc] Fix ExecutionEngine module build breakage
Author: Med Ismail Bennani Date: 2021-01-19T14:39:06+01:00 New Revision: 1d37db6ef53db453534b9edfcc6a58c4f4f5c914 URL: https://github.com/llvm/llvm-project/commit/1d37db6ef53db453534b9edfcc6a58c4f4f5c914 DIFF: https://github.com/llvm/llvm-project/commit/1d37db6ef53db453534b9edfcc6a58c4f4f5c914.diff LOG: [llvm/Orc] Fix ExecutionEngine module build breakage This patch updates the llvm module map to reflect changes made in `24672ddea3c97fd1eca3e905b23c0116d7759ab8` and fixes the module builds (`-DLLVM_ENABLE_MODULES=On`). Signed-off-by: Med Ismail Bennani Added: Modified: llvm/include/llvm/module.modulemap Removed: diff --git a/llvm/include/llvm/module.modulemap b/llvm/include/llvm/module.modulemap index 51a4a3d5eb3a..a199f7f2d79a 100644 --- a/llvm/include/llvm/module.modulemap +++ b/llvm/include/llvm/module.modulemap @@ -190,7 +190,7 @@ module LLVM_ExecutionEngine { exclude header "ExecutionEngine/Orc/RemoteObjectLayer.h" // Exclude headers from LLVM_OrcSupport. - exclude header "ExecutionEngine/Orc/OrcError.h" + exclude header "ExecutionEngine/Orc/Shared/OrcError.h" exclude header "ExecutionEngine/Orc/RPC/RPCUtils.h" exclude header "ExecutionEngine/Orc/RPC/RPCSerialization.h" exclude header "ExecutionEngine/Orc/RPC/RawByteChannel.h" @@ -210,7 +210,7 @@ module LLVM_FileCheck { module LLVM_OrcSupport { requires cplusplus - header "ExecutionEngine/Orc/OrcError.h" + header "ExecutionEngine/Orc/Shared/OrcError.h" header "ExecutionEngine/Orc/Shared/RPCUtils.h" header "ExecutionEngine/Orc/Shared/Serialization.h" header "ExecutionEngine/Orc/Shared/RawByteChannel.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] 197d9a5 - [flang][driver] Add standard macro predefinitions for compiler version
Author: Faris Rehman Date: 2021-01-19T13:22:59Z New Revision: 197d9a55f105391f34a0657e6c1d5ef3166dad7d URL: https://github.com/llvm/llvm-project/commit/197d9a55f105391f34a0657e6c1d5ef3166dad7d DIFF: https://github.com/llvm/llvm-project/commit/197d9a55f105391f34a0657e6c1d5ef3166dad7d.diff LOG: [flang][driver] Add standard macro predefinitions for compiler version Add the following standard predefinitions that f18 supports: * `__flang__`, * `__flang_major__`, * `__flang_minor__`, * `__flang_patchlevel__` Summary of changes: - Populate Fortran::parser::Options#predefinitions with the default supported predefinitions Differential Revision: https://reviews.llvm.org/D94516 Added: flang/test/Flang-Driver/predefined-macros-compiler-version.f90 Modified: flang/lib/Frontend/CompilerInvocation.cpp Removed: diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index aeb4ac3e274a..cd0faf215a5a 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -8,6 +8,7 @@ #include "flang/Frontend/CompilerInvocation.h" #include "flang/Frontend/PreprocessorOptions.h" +#include "flang/Version.inc" #include "clang/Basic/AllDiagnostics.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -258,6 +259,18 @@ void CompilerInvocation::SetDefaultFortranOpts() { std::vector searchDirectories{"."s}; fortranOptions.searchDirectories = searchDirectories; fortranOptions.isFixedForm = false; + + // Populate the macro list with version numbers and other predefinitions. + // TODO: When expanding this list of standard predefinitions, consider + // creating a dedicated API for this. Also at some point we will need to + // diff erentiate between diff erent targets. + fortranOptions.predefinitions.emplace_back("__flang__", "1"); + fortranOptions.predefinitions.emplace_back( + "__flang_major__", FLANG_VERSION_MAJOR_STRING); + fortranOptions.predefinitions.emplace_back( + "__flang_minor__", FLANG_VERSION_MINOR_STRING); + fortranOptions.predefinitions.emplace_back( + "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING); } void CompilerInvocation::setFortranOpts() { diff --git a/flang/test/Flang-Driver/predefined-macros-compiler-version.f90 b/flang/test/Flang-Driver/predefined-macros-compiler-version.f90 new file mode 100644 index ..bf59f305e884 --- /dev/null +++ b/flang/test/Flang-Driver/predefined-macros-compiler-version.f90 @@ -0,0 +1,26 @@ +! Check that the driver correctly defines macros with the compiler version + +! REQUIRES: new-flang-driver + +!-- +! FLANG DRIVER (flang-new) +!-- +! RUN: %flang-new -E %s 2>&1 | FileCheck %s --ignore-case + +!- +! FRONTEND FLANG DRIVER (flang-new -fc1) +!- +! RUN: %flang-new -fc1 -E %s 2>&1 | FileCheck %s --ignore-case + +!- +! EXPECTED OUTPUT +!- +! CHECK: flang = 1 +! CHECK: flang_major = {{[1-9][0-9]*$}} +! CHECK: flang_minor = {{[0-9]+$}} +! CHECK: flang_patchlevel = {{[0-9]+$}} + +integer, parameter :: flang = __flang__ +integer, parameter :: flang_major = __flang_major__ +integer, parameter :: flang_minor = __flang_minor__ +integer, parameter :: flang_patchlevel = __flang_patchlevel__ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [openmp] a60bc55 - [OpenMP] libomp: cleanup parsing of OMP_ALLOCATOR env variable.
Author: AndreyChurbanov Date: 2021-01-19T16:21:22+03:00 New Revision: a60bc55c693609e9417419b72754b9984f52acbe URL: https://github.com/llvm/llvm-project/commit/a60bc55c693609e9417419b72754b9984f52acbe DIFF: https://github.com/llvm/llvm-project/commit/a60bc55c693609e9417419b72754b9984f52acbe.diff LOG: [OpenMP] libomp: cleanup parsing of OMP_ALLOCATOR env variable. Differential Revision: https://reviews.llvm.org/D94932 Added: openmp/runtime/test/env/omp_alloc_env_invalid.c Modified: openmp/runtime/src/kmp_settings.cpp Removed: diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp index bfcd1faecdc0..e3270c79a702 100644 --- a/openmp/runtime/src/kmp_settings.cpp +++ b/openmp/runtime/src/kmp_settings.cpp @@ -3272,6 +3272,7 @@ static void __kmp_stg_print_affinity_format(kmp_str_buf_t *buffer, } __kmp_str_buf_print(buffer, "%s'\n", __kmp_affinity_format); } + // OMP_ALLOCATOR sets default allocator static void __kmp_stg_parse_allocator(char const *name, char const *value, void *data) { @@ -3289,104 +3290,65 @@ static void __kmp_stg_parse_allocator(char const *name, char const *value, */ const char *buf = value; const char *next; - int num; SKIP_WS(buf); - if ((*buf > '0') && (*buf < '9')) { -next = buf; -SKIP_DIGITS(next); -num = __kmp_str_to_int(buf, *next); -KMP_ASSERT(num > 0); -switch (num) { -case 4: + next = buf; + // check HBW first as the only non-default supported + if (__kmp_match_str("omp_high_bw_mem_alloc", buf, &next) || + __kmp_match_str("4", buf, &next)) { +SKIP_WS(next); +if (*next == '\0') { if (__kmp_memkind_available) { __kmp_def_allocator = omp_high_bw_mem_alloc; +return; } else { -__kmp_msg(kmp_ms_warning, - KMP_MSG(OmpNoAllocator, "omp_high_bw_mem_alloc"), - __kmp_msg_null); -__kmp_def_allocator = omp_default_mem_alloc; +KMP_WARNING(OmpNoAllocator, "omp_high_bw_mem_alloc"); } - break; -case 1: - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 2: - __kmp_msg(kmp_ms_warning, -KMP_MSG(OmpNoAllocator, "omp_large_cap_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 3: - __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_const_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 5: - __kmp_msg(kmp_ms_warning, -KMP_MSG(OmpNoAllocator, "omp_low_lat_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 6: - __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_cgroup_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 7: - __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_pteam_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; -case 8: - __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_thread_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; - break; } -return; - } - next = buf; - if (__kmp_match_str("omp_high_bw_mem_alloc", buf, &next)) { -if (__kmp_memkind_available) { - __kmp_def_allocator = omp_high_bw_mem_alloc; -} else { - __kmp_msg(kmp_ms_warning, -KMP_MSG(OmpNoAllocator, "omp_high_bw_mem_alloc"), -__kmp_msg_null); - __kmp_def_allocator = omp_default_mem_alloc; + } else if (__kmp_match_str("omp_default_mem_alloc", buf, &next) || + __kmp_match_str("1", buf, &next)) { +// default requested +SKIP_WS(next); + } else if (__kmp_match_str("omp_large_cap_mem_alloc", buf, &next) || + __kmp_match_str("2", buf, &next)) { +SKIP_WS(next); +if (*next == '\0') { + KMP_WARNING(OmpNoAllocator, "omp_large_cap_mem_alloc"); +} + } else if (__kmp_match_str("omp_const_mem_alloc", buf, &next) || + __kmp_match_str("3", buf, &next)) { +SKIP_WS(next); +if (*next == '\0') { + KMP_WARNING(OmpNoAllocator, "omp_const_mem_alloc"); +} + } else if (__kmp_match_str("omp_low_lat_mem_alloc", buf, &next) || + __kmp_match_str("5", buf, &next)) { +SKIP_WS(next); +if (*next == '\0') { + KMP_WARNING(OmpNoAllocator, "omp_low_lat_mem_alloc"); +} + } else if (__kmp_match_str("omp_cgroup_mem_alloc", buf, &next) || + __kmp_match_str("6", buf, &next)) { +SKIP_WS(next); +if (*next == '\0') { + KMP_WARNING(OmpNoAllocator, "omp_cgroup_mem_alloc"); +} + } else if (__kmp_match_str("omp_pteam_m
[llvm-branch-commits] [debuginfo-tests] d77a572 - [DebugInfo][dexter] Tweak dexter test for merged values
Author: OCHyams Date: 2021-01-19T12:45:31Z New Revision: d77a57208770470d546194ad81bd01ae5d94df0d URL: https://github.com/llvm/llvm-project/commit/d77a57208770470d546194ad81bd01ae5d94df0d DIFF: https://github.com/llvm/llvm-project/commit/d77a57208770470d546194ad81bd01ae5d94df0d.diff LOG: [DebugInfo][dexter] Tweak dexter test for merged values Tweak dexter-tests/memvars/inline-escaping-function.c added in D94761 (b7e516202eb6) by adding a 'param' use after the merge point. The test XFAILS with and without this change, but without it the test looks very similar to memvars/unused-merged-value.c. The test now demonstrates the problem more clearly. Added: Modified: debuginfo-tests/dexter-tests/memvars/inline-escaping-function.c Removed: diff --git a/debuginfo-tests/dexter-tests/memvars/inline-escaping-function.c b/debuginfo-tests/dexter-tests/memvars/inline-escaping-function.c index f2a22e69015a..16b4d1dda56f 100644 --- a/debuginfo-tests/dexter-tests/memvars/inline-escaping-function.c +++ b/debuginfo-tests/dexter-tests/memvars/inline-escaping-function.c @@ -35,7 +35,7 @@ int fun(int param) { if (param) param = inlineme(¶m); fluff(); // DexLabel('s0') - return 0; + return param; } int main() { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] 443d695 - [flang][driver] Add support for fixed form detection
Author: Faris Rehman Date: 2021-01-19T12:58:01Z New Revision: 443d6957ca712aacdfd72c3408a8837580f6a286 URL: https://github.com/llvm/llvm-project/commit/443d6957ca712aacdfd72c3408a8837580f6a286 DIFF: https://github.com/llvm/llvm-project/commit/443d6957ca712aacdfd72c3408a8837580f6a286.diff LOG: [flang][driver] Add support for fixed form detection Currently the new flang driver always runs in free form mode. This patch adds support for fixed form mode detection based on the file extensions. Like `f18`, `flang-new` will treat files ending with ".f", ".F" and ".ff" as fixed form. Additionally, ".for", ".FOR", ".fpp" and ".FPP" file extensions are recognised as fixed form files. This is consistent with gfortran [1]. In summary, files with the following extensions are treated as fixed-form: * ".f", ".F", ".ff", ".for", ".FOR", ".fpp", ".FPP" For consistency with flang/test/lit.cfg.py and f18, this patch also adds support for the following file extensions: * ".ff", ".FOR", ".for", ".ff90", ".fpp", ".FPP" This is added in flang/lib/Frontend/FrontendOptions.cpp. Additionally, the following extensions are included: * ".f03", ".F03", ".f08", ".F08" This is for compatibility with gfortran [1] and other popular Fortran compilers [2]. NOTE: internally Flang will only differentiate between fixed and free form files. Currently Flang does not support switching between language standards, so in this regard file extensions are irrelevant. More specifically, both `file.f03` and `file.f18` are represented with `Language::Fortran` (as opposed to e.g. `Language::Fortran03`). Summary of changes: - Set Fortran::parser::Options::sFixedForm according to the file type - Add isFixedFormSuffix and isFreeFormSuffix helper functions to FrontendTool/Utils.h - Change FrontendOptions::GetInputKindForExtension to support the missing file extensions that f18 supports and some additional ones - FrontendActionTest.cpp is updated to make sure that the test input is treated as free-form [1] https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-and-GCC.html [2] https://github.com/llvm/llvm-project/blob/master/flang/docs/OptionComparison.md#notes Differential Revision: https://reviews.llvm.org/D94228 Added: flang/test/Flang-Driver/Inputs/fixed-form-test.f flang/test/Flang-Driver/Inputs/free-form-test.f90 flang/test/Flang-Driver/fixed-free-detection.f90 Modified: flang/include/flang/FrontendTool/Utils.h flang/lib/Frontend/FrontendAction.cpp flang/lib/Frontend/FrontendOptions.cpp flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp flang/test/lit.cfg.py flang/unittests/Frontend/FrontendActionTest.cpp Removed: diff --git a/flang/include/flang/FrontendTool/Utils.h b/flang/include/flang/FrontendTool/Utils.h index d62c03d8dc0b..7ee7568e21de 100644 --- a/flang/include/flang/FrontendTool/Utils.h +++ b/flang/include/flang/FrontendTool/Utils.h @@ -14,6 +14,8 @@ #ifndef LLVM_FLANG_FRONTENDTOOL_UTILS_H #define LLVM_FLANG_FRONTENDTOOL_UTILS_H +#include "llvm/ADT/StringRef.h" + namespace Fortran::frontend { class CompilerInstance; @@ -31,6 +33,14 @@ std::unique_ptr CreateFrontendAction(CompilerInstance &ci); /// \return - True on success. bool ExecuteCompilerInvocation(CompilerInstance *flang); +/// \param suffix The file extension +/// \return True if the file extension should be processed as fixed form +bool isFixedFormSuffix(llvm::StringRef suffix); + +/// \param suffix The file extension +/// \return True if the file extension should be processed as free form +bool isFreeFormSuffix(llvm::StringRef suffix); + } // end namespace Fortran::frontend #endif // LLVM_FLANG_FRONTENDTOOL_UTILS_H diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp index 4d8a9d43d114..6da1e6191036 100644 --- a/flang/lib/Frontend/FrontendAction.cpp +++ b/flang/lib/Frontend/FrontendAction.cpp @@ -9,6 +9,7 @@ #include "flang/Frontend/FrontendAction.h" #include "flang/Frontend/CompilerInstance.h" #include "flang/Frontend/FrontendActions.h" +#include "flang/FrontendTool/Utils.h" #include "llvm/Support/Errc.h" using namespace Fortran::frontend; @@ -51,6 +52,12 @@ llvm::Error FrontendAction::Execute() { Fortran::parser::Options parserOptions = this->instance().invocation().fortranOpts(); + // Set the fixed form flag based on the file extension + auto pathDotIndex{currentInputPath.rfind(".")}; + if (pathDotIndex != std::string::npos) { +std::string pathSuffix{currentInputPath.substr(pathDotIndex + 1)}; +parserOptions.isFixedForm = isFixedFormSuffix(pathSuffix); + } // Prescan. In case of failure, report and return. ci.parsing().Prescan(currentInputPath, parserOptions); diff --git a/flang/lib/Frontend/FrontendOptions.cpp b/flang/lib/Frontend/FrontendOptions.cpp index 1757db3bb0d6..8c206b308176 100644 --- a/flang/lib/Frontend/FrontendOptions.cpp
[llvm-branch-commits] [clang] a6f9077 - [clang] Check for nullptr when instantiating late attrs
Author: Adam Czachorowski Date: 2021-01-19T13:43:15+01:00 New Revision: a6f9077b16da90204b296acd4f840769e83460ac URL: https://github.com/llvm/llvm-project/commit/a6f9077b16da90204b296acd4f840769e83460ac DIFF: https://github.com/llvm/llvm-project/commit/a6f9077b16da90204b296acd4f840769e83460ac.diff LOG: [clang] Check for nullptr when instantiating late attrs This was already done in SemaTemplateInstantiateDecl.cpp, but not in SemaTemplateInstantiate.cpp. Anecdotally I've seen some clangd crashes where coredumps point to this being a problem, but I cannot reproduce this so far. Differential Revision: https://reviews.llvm.org/D94933 Added: Modified: clang/lib/Sema/SemaTemplateInstantiate.cpp Removed: diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index cb74f08830c8..7679063ead71 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2796,7 +2796,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, Attr *NewAttr = instantiateTemplateAttribute(I->TmplAttr, Context, *this, TemplateArgs); -I->NewDecl->addAttr(NewAttr); +if (NewAttr) + I->NewDecl->addAttr(NewAttr); LocalInstantiationScope::deleteScopes(I->Scope, Instantiator.getStartingScope()); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 9a60ad2 - [mlir] Clarify docs around LLVM dialect-compatible types
Author: Alex Zinenko Date: 2021-01-19T13:42:16+01:00 New Revision: 9a60ad216d2fa2e9701849922bfb0db9917f9c93 URL: https://github.com/llvm/llvm-project/commit/9a60ad216d2fa2e9701849922bfb0db9917f9c93 DIFF: https://github.com/llvm/llvm-project/commit/9a60ad216d2fa2e9701849922bfb0db9917f9c93.diff LOG: [mlir] Clarify docs around LLVM dialect-compatible types Explicitly mention that there is exactly one MLIR type that corresponds to a given LLVM IR type. Added: Modified: mlir/docs/Dialects/LLVM.md Removed: diff --git a/mlir/docs/Dialects/LLVM.md b/mlir/docs/Dialects/LLVM.md index b396cdebf067..521c5f4c328b 100644 --- a/mlir/docs/Dialects/LLVM.md +++ b/mlir/docs/Dialects/LLVM.md @@ -224,6 +224,11 @@ compatible. For example, signed and unsigned integers are not compatible. LLVM provides a function, `bool LLVM::isCompatibleType(Type)`, that can be used as a compatibility check. +Each LLVM IR type corresponds to *exactly one* MLIR type, either built-in or +LLVM dialect type. For example, because `i32` is LLVM-compatible, there is no +`!llvm.i32` type. However, `!llvm.ptr` is defined in the LLVM dialect as +there is no corresponding built-in type. + ### Additional Simple Types The following non-parametric types derived from the LLVM IR are available in the ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits