1. Jul 27, 2022
    • Walter Erquinigo's avatar
      Move GetControlFlowKind's logic to DisassemblerLLVMC.cpp · 0538e543
      Walter Erquinigo authored
      This diff move the logic of `GetControlFlowKind()` from Disassembler.cpp to DisassemblerLLVMC.cpp.
      Here's details:
      - Actual logic of GetControlFlowKind() move to `DisassemblerLLVMC.cpp`, and we can check underlying architecture using `DisassemblerScope` there.
      - With this change, passing 'triple' to `GetControlFlowKind()` is no more required.
      
      Reviewed By: wallace
      
      Differential Revision: https://reviews.llvm.org/D130320
      0538e543
    • Walter Erquinigo's avatar
      [trace][intel pt] Introduce wall clock time for each trace item · 4f676c25
      Walter Erquinigo authored
      - Decouple TSCs from trace items
      - Turn TSCs into events just like CPUs. The new name is HW clock tick, wich could be reused by other vendors.
      - Add a GetWallTime that returns the wall time that the trace plug-in can infer for each trace item.
      - For intel pt, we are doing the following interpolation: if an instruction takes less than 1 TSC, we use that duration, otherwise, we assume the instruction took 1 TSC. This helps us avoid having to handle context switches, changes to kernel, idle times, decoding errors, etc. We are just trying to show some approximation and not the real data. For the real data, TSCs are the way to go. Besides that, we are making sure that no two trace items will give the same interpolation value. Finally, we are using as time 0 the time at which tracing started.
      
      Sample output:
      
      ```
      (lldb) r
      Process 750047 launched: '/home/wallace/a.out' (x86_64)
      Process 750047 stopped
      * thread #1, name = 'a.out', stop reason = breakpoint 1.1
          frame #0: 0x0000000000402479 a.out`main at main.cpp:29:20
         26   };
         27
         28   int main() {
      -> 29     std::vector<int> vvv;
         30     for (int i = 0; i < 100; i++)
         31       vvv.push_back(i);
         32
      (lldb) process trace start -s 64kb -t --per-cpu
      (lldb) b 60
      Breakpoint 2: where = a.out`main + 1689 at main.cpp:60:23, address = 0x0000000000402afe
      (lldb) c
      Process 750047 resuming
      Process 750047 stopped
      * thread #1, name = 'a.out', stop reason = breakpoint 2.1
          frame #0: 0x0000000000402afe a.out`main at main.cpp:60:23
         57     map<int, int> m;
         58     m[3] = 4;
         59
      -> 60     map<string, string> m2;
         61     m2["5"] = "6";
         62
         63     std::vector<std::string> vs = {"2", "3"};
      (lldb) thread trace dump instructions -t -f -e thread #1: tid = 750047
          0: [379567.000 ns] (event) HW clock tick [48599428476224707]
          1: [379569.000 ns] (event) CPU core changed [new CPU=2]
          2: [390487.000 ns] (event) HW clock tick [48599428476246495]
          3: [1602508.000 ns] (event) HW clock tick [48599428478664855]
          4: [1662745.000 ns] (event) HW clock tick [48599428478785046]
        libc.so.6`malloc
          5: [1662746.995 ns] 0x00007ffff7176660    endbr64
          6: [1662748.991 ns] 0x00007ffff7176664    movq   0x32387d(%rip), %rax      ;  + 408
          7: [1662750.986 ns] 0x00007ffff717666b    pushq  %r12
          8: [1662752.981 ns] 0x00007ffff717666d    pushq  %rbp
          9: [1662754.977 ns] 0x00007ffff717666e    pushq  %rbx
          10: [1662756.972 ns] 0x00007ffff717666f    movq   (%rax), %rax
          11: [1662758.967 ns] 0x00007ffff7176672    testq  %rax, %rax
          12: [1662760.963 ns] 0x00007ffff7176675    jne    0x9c7e0                   ; <+384>
          13: [1662762.958 ns] 0x00007ffff717667b    leaq   0x17(%rdi), %rax
          14: [1662764.953 ns] 0x00007ffff717667f    cmpq   $0x1f, %rax
          15: [1662766.949 ns] 0x00007ffff7176683    ja     0x9c730                   ; <+208>
          16: [1662768.944 ns] 0x00007ffff7176730    andq   $-0x10, %rax
          17: [1662770.939 ns] 0x00007ffff7176734    cmpq   $-0x41, %rax
          18: [1662772.935 ns] 0x00007ffff7176738    seta   %dl
          19: [1662774.930 ns] 0x00007ffff717673b    jmp    0x9c690                   ; <+48>
          20: [1662776.925 ns] 0x00007ffff7176690    cmpq   %rdi, %rax
          21: [1662778.921 ns] 0x00007ffff7176693    jb     0x9c7b0                   ; <+336>
          22: [1662780.916 ns] 0x00007ffff7176699    testb  %dl, %dl
          23: [1662782.911 ns] 0x00007ffff717669b    jne    0x9c7b0                   ; <+336>
          24: [1662784.906 ns] 0x00007ffff71766a1    movq   0x3236c0(%rip), %r12      ;  + 24
      (lldb) thread trace dump instructions -t -f -e -J -c 4
      [
        {
          "id": 0,
          "timestamp_ns": "379567.000000",
          "event": "HW clock tick",
          "hwClock": 48599428476224707
        },
        {
          "id": 1,
          "timestamp_ns": "379569.000000",
          "event": "CPU core changed",
          "cpuId": 2
        },
        {
          "id": 2,
          "timestamp_ns": "390487.000000",
          "event": "HW clock tick",
          "hwClock": 48599428476246495
        },
        {
          "id": 3,
          "timestamp_ns": "1602508.000000",
          "event": "HW clock tick",
          "hwClock": 48599428478664855
        },
        {
          "id": 4,
          "timestamp_ns": "1662745.000000",
          "event": "HW clock tick",
          "hwClock": 48599428478785046
        },
        {
          "id": 5,
          "timestamp_ns": "1662746.995324",
          "loadAddress": "0x7ffff7176660",
          "module": "libc.so.6",
          "symbol": "malloc",
          "mnemonic": "endbr64"
        },
        {
          "id": 6,
          "timestamp_ns": "1662748.990648",
          "loadAddress": "0x7ffff7176664",
          "module": "libc.so.6",
          "symbol": "malloc",
          "mnemonic": "movq"
        },
        {
          "id": 7,
          "timestamp_ns": "1662750.985972",
          "loadAddress": "0x7ffff717666b",
          "module": "libc.so.6",
          "symbol": "malloc",
          "mnemonic": "pushq"
        },
        {
          "id": 8,
          "timestamp_ns": "1662752.981296",
          "loadAddress": "0x7ffff717666d",
          "module": "libc.so.6",
          "symbol": "malloc",
          "mnemonic": "pushq"
        }
      ]
      ```
      
      Differential Revision: https://reviews.llvm.org/D130054
      4f676c25
    • Sanjay Patel's avatar
      [InstSimplify] remove redundant calls to 'isImplied'; NFCI · dcd09467
      Sanjay Patel authored
      We already call the more general isImpliedCondition() (which calls
      isImpliedTrueByMatchingCmp() internally) from simplifyAndInst()
      and simplifyOrInst().
      
      There was a difference visible with this change on a vector test
      before a925bef7, but I can't find any gaps now.
      dcd09467
    • LLVM GN Syncbot's avatar
      [gn build] Port 4638d7a2 · c17420fd
      LLVM GN Syncbot authored
      c17420fd
    • Blue Gaston's avatar
      [Sanitizers][Darwin] Allows '-mtargetos' to used to set minimum deployment target. · a89982c4
      Blue Gaston authored
      Currently, m{platform}-version-min is default flag used to set min deployment target within compilter-rt and sanitizers.
      However, clang uses flags -target and -mtargetos for setting target triple and minimum deployment targets.
      -mtargetos will be the preferred flag to set min version in the future and the
      ${platform}-version-min flag will not be used for future platforms.
      
      This change allows darwin platforms to use either ${platform}-min-version or -mtargetos
      without breaking lit test flags that allows for overriding the default min value in lit tests
      Tests using flags: 'darwin_min_target_with_tls_support', 'min_macos_deployment_target'
      will no longer fail if they use mtargetos instead of version-min.
      
      rdar://81028225
      
      Differential Revision: https://reviews.llvm.org/D130542
      a89982c4
    • Lambert, Jacob's avatar
      Revert "[clang-offload-bundler] Library-ize ClangOffloadBundler" · 4638d7a2
      Lambert, Jacob authored
      This reverts commit 8348c409.
      4638d7a2
    • Francis Visoiu Mistrih's avatar
      [Matrix] Add assert to catch extracted vectors with poison elements · 448a094d
      Francis Visoiu Mistrih authored
      Assert when the extracted vector is wider than the row/column.
      
      Differential Revision: https://reviews.llvm.org/D130173
      448a094d
    • Craig Topper's avatar
      [RISCV] Add Predicate to c.lw/c.sw/c.lwsp/c.swsp InstAliases with no offset. · 3a2d7d8a
      Craig Topper authored
      These are aliases that allow the immediate offset to be ommitted.
      We had predicates for the RV64, RV32+F, and D versions, but
      not the base versions.
      
      I've also re-ordered them to share Predicate lines to improve
      readability.
      3a2d7d8a
    • Francis Visoiu Mistrih's avatar
      [Matrix] Refactor tiled loops in a struct. NFC · 2c6e8b46
      Francis Visoiu Mistrih authored
      The three loops have the same structure: index, header, latch.
      2c6e8b46
    • Jessica Paquette's avatar
      [GlobalISel] Import patterns for G_FMAXIMUM + G_FMINIMUM · 39d431d8
      Jessica Paquette authored
      Allows us to select scalar instructions on AArch64.
      
      Differential Revision: https://reviews.llvm.org/D115381
      39d431d8
    • Sam Estep's avatar
      [clang][dataflow] Analyze calls to in-TU functions · 300fbf56
      Sam Estep authored
      This patch adds initial support for context-sensitive analysis of simple functions whose definition is available in the translation unit, guarded by the `ContextSensitive` flag in the new `TransferOptions` struct. When this option is true, the `VisitCallExpr` case in the builtin transfer function has a fallthrough case which checks for a direct callee with a body. In that case, it constructs a CFG from that callee body, uses the new `pushCall` method on the `Environment` to make an environment to analyze the callee, and then calls `runDataflowAnalysis` with a `NoopAnalysis` (disabling context-sensitive analysis on that sub-analysis, to avoid problems with recursion). After the sub-analysis completes, the `Environment` from its exit block is simply assigned back to the environment at the callsite.
      
      The `pushCall` method (which currently only supports non-method functions with some restrictions) maps the `SourceLocation`s for all the parameters to the existing source locations for the corresponding arguments from the callsite.
      
      This patch adds a few tests to check that this context-sensitive analysis works on simple functions. More sophisticated functionality will be added later; the most important next step is to explicitly model context in some fields of the `DataflowAnalysisContext` class, as mentioned in a `FIXME` comment in the `pushCall` implementation.
      
      Reviewed By: ymandel, xazax.hun
      
      Differential Revision: https://reviews.llvm.org/D130306
      300fbf56
    • Craig Topper's avatar
      [RISCV] Minor fixes to rv64c-valid.s test. · bc165de1
      Craig Topper authored
      -Missing CHECK-NO-EXT and CHECK-NO-RV64 on subw.
      -Stray CHECK-NO-RV64 on c.slli.
      -c.slli used immediate 1 instead of RV64 only immediate like 63.
      -Missing CHECK-NO-EXT on c.srli and c.srai
      bc165de1
    • Nico Weber's avatar
      [gn build] Port 8348c409 · 215a792c
      Nico Weber authored
      215a792c
    • Jon Chesterfield's avatar
    • Sam Estep's avatar
      Revert "[clang][dataflow] Analyze calls to in-TU functions" · cc9aa157
      Sam Estep authored
      This reverts commit fa2b83d0.
      cc9aa157
    • Sam Estep's avatar
      [clang][dataflow] Analyze calls to in-TU functions · fa2b83d0
      Sam Estep authored
      Depends On D130305
      
      This patch adds initial support for context-sensitive analysis of simple functions whose definition is available in the translation unit, guarded by the `ContextSensitive` flag in the new `TransferOptions` struct. When this option is true, the `VisitCallExpr` case in the builtin transfer function has a fallthrough case which checks for a direct callee with a body. In that case, it constructs a CFG from that callee body, uses the new `pushCall` method on the `Environment` to make an environment to analyze the callee, and then calls `runDataflowAnalysis` with a `NoopAnalysis` (disabling context-sensitive analysis on that sub-analysis, to avoid problems with recursion). After the sub-analysis completes, the `Environment` from its exit block is simply assigned back to the environment at the callsite.
      
      The `pushCall` method (which currently only supports non-method functions with some restrictions) first calls `initGlobalVars`, then maps the `SourceLocation`s for all the parameters to the existing source locations for the corresponding arguments from the callsite.
      
      This patch adds a few tests to check that this context-sensitive analysis works on simple functions. More sophisticated functionality will be added later; the most important next step is to explicitly model context in some fields of the `DataflowAnalysisContext` class, as mentioned in a `TODO` comment in the `pushCall` implementation.
      
      Reviewed By: ymandel, xazax.hun
      
      Differential Revision: https://reviews.llvm.org/D130306
      fa2b83d0
    • Fangrui Song's avatar
      [MachineFunctionPass] Support -print-changed and -print-changed=quiet · f106525d
      Fangrui Song authored
      -print-changed for new pass manager is handy beside -print-after-all.
      Port it to MachineFunctionPass.
      
      Note: lib/Passes/StandardInstrumentations.cpp implements a number of
      misc features. If we want to use them for codegen, we may need to lift
      some functionality to LLVMIR.
      
      Reviewed By: aeubanks, jamieschmeiser
      
      Differential Revision: https://reviews.llvm.org/D130434
      f106525d
    • Jim Ingham's avatar
      StackFrame::GetValueObjectForFrameVariable holds the StackFrame lock too long. · 8b7775a4
      Jim Ingham authored
      This can cause a deadlock if other threads use the common pattern of
      "lock the StackFrameList, get a frame, lock the StackFrame."
      
      Differential Revision: https://reviews.llvm.org/D130524
      8b7775a4
    • Jacob Lambert's avatar
      [clang-offload-bundler] Library-ize ClangOffloadBundler · 8348c409
      Jacob Lambert authored
      Lifting the core functionalities of the clang-offload-bundler into a
      user-facing library/API. This will allow online and JIT compilers to
      bundle and unbundle files without spawning a new process.
      
      This patch lifts the classes and functions used to implement
      the clang-offload-bundler into a separate OffloadBundler.cpp,
      and defines three top-level API functions in OfflaodBundler.h.
              BundleFiles()
              UnbundleFiles()
              UnbundleArchives()
      
      This patch also introduces a Config class that locally stores the
      previously global cl::opt options and arrays to allow users to call
      the APIs in a multi-threaded context, and introduces an
      OffloadBundler class to encapsulate the top-level API functions.
      
      We also  lift the BundlerExecutable variable, which is specific
      to the clang-offload-bundler tool, from the API, and replace
      its use with an ObjcopyPath variable. This variable must be set
      in order to internally call llvm-objcopy.
      
      Finally, we move the API files from
      clang/tools/clang-offload-bundler into clang/lib/Driver and
      clang/include/clang/Driver.
      
      Differential Revision: https://reviews.llvm.org/D129873
      8348c409
    • Simon Pilgrim's avatar
      [DAG] matchRotateSub - set demanded bits to the shift amount type size, not the shift result size. · 1ea7b9c6
      Simon Pilgrim authored
      This should fix a report on D130251 of an assert due to a bitwidth mismatch in APInt::isSubSetOf
      1ea7b9c6
    • Fangrui Song's avatar
      [AArch64] Simplify BTI/PAC-RET module flags · de1b5c91
      Fangrui Song authored
      These module flags use the Min merge behavior with a default value of
      zero, so we don't need to emit them if zero.
      
      Reviewed By: danielkiss
      
      Differential Revision: https://reviews.llvm.org/D130145
      de1b5c91
    • Dmitry Preobrazhensky's avatar
      [AMDGPU][GFX10][DOC][NFC] Update assembler syntax description · 9891bb23
      Dmitry Preobrazhensky authored
      Summary of changes:
      - Update FLAT LDS syntax (see https://reviews.llvm.org/D125126)
      9891bb23
    • David Goldman's avatar
      [clangd] Improve XRefs support for ObjCMethodDecl · 88a2ac6a
      David Goldman authored
      - Correct nameLocation to point to the first selector fragment instead
        of the - or +
      
      - getDefinition now searches through the proper impl decls to find
        the definition of the ObjCMethodDecl if one exists
      
      Differential Revision: https://reviews.llvm.org/D130095
      88a2ac6a
    • Matthias Springer's avatar
      [mlir][transform] Add ForeachOp to transform dialect · bffec215
      Matthias Springer authored
      This op "unbatches" an op handle and executes the loop body for each payload op.
      
      Differential Revision: https://reviews.llvm.org/D130257
      bffec215
  2. Jul 26, 2022