Skip to content
  1. Mar 17, 2021
  2. Mar 16, 2021
    • Eugene Zhulenev's avatar
      [mlir] Add lowering from math::Log1p to LLVM · 74f6138b
      Eugene Zhulenev authored
      [mlir] Add lowering from math::Log1p to LLVM
      
      Reviewed By: cota
      
      Differential Revision: https://reviews.llvm.org/D98662
      74f6138b
    • Anirudh Prasad's avatar
      9f5da800
    • peter klausler's avatar
      [flang] Order Symbols by source provenance · 46ade6d0
      peter klausler authored
      In parser::AllCookedSources, implement a map from CharBlocks to
      the CookedSource instances that they cover.  This permits a fast
      Find() operation based on std::map::equal_range to map a CharBlock
      to its enclosing CookedSource instance.
      
      Add a creation order number to each CookedSource.  This allows
      AllCookedSources to provide a Precedes(x,y) predicate that is a
      true source stream ordering between two CharBlocks -- x is less
      than y if it is in an earlier CookedSource, or in the same
      CookedSource at an earlier position.
      
      Add a reference to the singleton SemanticsContext to each Scope.
      
      All of this allows operator< to be implemented on Symbols by
      means of a true source ordering.  From a Symbol, we get to
      its Scope, then to the SemanticsContext, and then use its
      AllCookedSources reference to call Precedes().
      
      Differential Revision: https://reviews.llvm.org/D98743
      46ade6d0
    • Emily Shi's avatar
      [asan] disable MallocNanoZone for no fd test on darwin · c2f3b2f9
      Emily Shi authored
      On Darwin, MallocNanoZone may log after execv, which messes up this test.
      Disable MallocNanoZone for this test since we don't use it anyway with asan.
      
      This environment variable should only affect Darwin and not change behavior on other platforms.
      
      rdar://74992832
      
      Reviewed By: delcypher
      
      Differential Revision: https://reviews.llvm.org/D98735
      c2f3b2f9
    • Vitaly Buka's avatar
      [sanitizer][NFC] Fix compilation error on Windows · 9adc9073
      Vitaly Buka authored
      And remove unnecessary const_cast in ubsan.
      9adc9073
    • Zequan Wu's avatar
      Revert "[ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()" · cbd7eabe
      Zequan Wu authored
      That commit caused chromium build to crash: https://bugs.chromium.org/p/chromium/issues/detail?id=1188885
      
      This reverts commit edf70048.
      cbd7eabe
    • Michael Kruse's avatar
      [Polly][CodeGen] Allow nesting of BandAttr mark without loop. · 5f58aae8
      Michael Kruse authored
      BandAttr markers are added as parents of schedule tree bands. These also
      appear as markers its equivalent AST, but a band does not necessarily
      corresponds to a loop in this. Iterations may be peeled or the loop
      being unrolled (e.g. if it has just one iteration). In such cases it may
      happend that there is not loop between a BandAttr marker and the marker
      for a loop nested in the former parent band/loop.
      
      Handle the situation by giving priority to the inner marker over the
      outer.
      
      Fixes the polly-x86_64-linux-test-suite buildbot.
      5f58aae8
    • Sanjay Patel's avatar
      [SLP] separate min/max matching from its instruction-level implementation; NFC · 7202f475
      Sanjay Patel authored
      The motivation is to handle integer min/max reductions independently
      of whether they are in the current cmp+sel form or the planned intrinsic
      form.
      
      We assumed that min/max included a select instruction, but we can
      decouple that implementation detail by checking the instructions
      themselves rather than relying on the recurrence (reduction) type.
      7202f475
    • Fangrui Song's avatar
      [RISCV] Make empty name symbols SF_FormatSpecific so that llvm-symbolizer... · 5d037458
      Fangrui Song authored
      [RISCV] Make empty name symbols SF_FormatSpecific so that llvm-symbolizer ignores them for symbolization
      
      On RISC-V, clang emits empty name symbols used for label differences. (In GCC the symbols are typically `.L0`)
      After D95916, the empty name symbols can show up in llvm-symbolizer's symbolization output.
      They have no names and thus not useful. Set `SF_FormatSpecific` so that llvm-symbolizer will ignore them.
      
      `SF_FormatSpecific` is also used in LTO but that case should not matter.
      
      Corresponding addr2line problem: https://sourceware.org/bugzilla/show_bug.cgi?id=27585
      
      Reviewed By: luismarques
      
      Differential Revision: https://reviews.llvm.org/D98669
      5d037458
    • Vitaly Buka's avatar
      [sanitizer][NFC] Remove InternalScopedString::size() · f5e6182c
      Vitaly Buka authored
      size() is inconsistent with length().
      In most size() use cases we can replace InternalScopedString with
      InternalMmapVector.
      
      Remove non-constant data() to avoid direct manipulations of internal
      buffer. append() should be enought to modify InternalScopedString.
      f5e6182c
    • Anirudh Prasad's avatar
      [AsmParser][SystemZ][z/OS] Reland "Introduce HLASM Comment Syntax" · b605cfb3
      Anirudh Prasad authored
      - Previously, https://reviews.llvm.org/D97703 was [[ https://reviews.llvm.org/D98543 | reverted ]] as it broke when building the unit tests when shared libs on.
      - This patch reverts the "revert" and makes two minor changes
      - The first is it also links in the MCParser lib when building the unittest. This should resolve the issue when building with with shared libs on and off
      - The second renames the name of the unit test from `SystemZAsmLexer` to `SystemZAsmLexerTests` since the convention for unittest binaries is to suffix the name of the unit test with "Tests"
      
      Reviewed By: Kai
      
      Differential Revision: https://reviews.llvm.org/D98666
      b605cfb3
    • Roland McGrath's avatar
      [AArch64] Parse "rng" feature flag in .arch directive · d5df500a
      Roland McGrath authored
      Reviewed By: phosek
      
      Differential Revision: https://reviews.llvm.org/D98566
      d5df500a
    • Mohammad Hadi Jooybar's avatar
      [InstCombine] Avoid Bitcast-GEP fusion for pointers directly from allocation functions · 302b80ab
      Mohammad Hadi Jooybar authored
      Elimination of bitcasts with void pointer arguments results in GEPs with pure byte indexes. These GEPs do not preserve struct/array information and interrupt phi address translation in later pipeline stages.
      
      Here is the original motivation for this patch:
      
      ```
      #include<stdio.h>
      #include<malloc.h>
      
      typedef struct __Node{
      
        double f;
        struct __Node *next;
      
      } Node;
      
      void foo () {
        Node *a = (Node*) malloc (sizeof(Node));
        a->next = NULL;
        a->f = 11.5f;
      
        Node *ptr = a;
        double sum = 0.0f;
        while (ptr) {
          sum += ptr->f;
          ptr = ptr->next;
        }
        printf("%f\n", sum);
      }
      ```
      By explicit assignment  `a->next = NULL`, we can infer the length of the link list is `1`. In this case we can eliminate while loop traversal entirely. This elimination is supposed to be performed by GVN/MemoryDependencyAnalysis/PhiTranslation .
      
      The final IR before this patch:
      
      ```
      define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
      entry:
        %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
        %next = getelementptr inbounds i8, i8* %call, i64 8
        %0 = bitcast i8* %next to %struct.__Node**
        store %struct.__Node* null, %struct.__Node** %0, align 8, !tbaa !2
        %f = bitcast i8* %call to double*
        store double 1.150000e+01, double* %f, align 8, !tbaa !8
        %tobool12 = icmp eq i8* %call, null
        br i1 %tobool12, label %while.end, label %while.body.lr.ph
      
      while.body.lr.ph:                                 ; preds = %entry
        %1 = bitcast i8* %call to %struct.__Node*
        br label %while.body
      
      while.body:                                       ; preds = %while.body.lr.ph, %while.body
        %sum.014 = phi double [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ]
        %ptr.013 = phi %struct.__Node* [ %1, %while.body.lr.ph ], [ %3, %while.body ]
        %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
        %2 = load double, double* %f1, align 8, !tbaa !8
        %add = fadd contract double %sum.014, %2
        %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
        %3 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
        %tobool = icmp eq %struct.__Node* %3, null
        br i1 %tobool, label %while.end, label %while.body
      
      while.end:                                        ; preds = %while.body, %entry
        %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %while.body ]
        %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
        ret void
      }
      ```
      
      Final IR after this patch:
      ```
      ; Function Attrs: nofree nounwind
      define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
      while.end:
        %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.150000e+01)
        ret void
      }
      ```
      
      IR before GVN before this patch:
      ```
      define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
      entry:
        %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
        %next = getelementptr inbounds i8, i8* %call, i64 8
        %0 = bitcast i8* %next to %struct.__Node**
        store %struct.__Node* null, %struct.__Node** %0, align 8, !tbaa !2
        %f = bitcast i8* %call to double*
        store double 1.150000e+01, double* %f, align 8, !tbaa !8
        %tobool12 = icmp eq i8* %call, null
        br i1 %tobool12, label %while.end, label %while.body.lr.ph
      
      while.body.lr.ph:                                 ; preds = %entry
        %1 = bitcast i8* %call to %struct.__Node*
        br label %while.body
      
      while.body:                                       ; preds = %while.body.lr.ph, %while.body
        %sum.014 = phi double [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ]
        %ptr.013 = phi %struct.__Node* [ %1, %while.body.lr.ph ], [ %3, %while.body ]
        %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
        %2 = load double, double* %f1, align 8, !tbaa !8
        %add = fadd contract double %sum.014, %2
        %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
        %3 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
        %tobool = icmp eq %struct.__Node* %3, null
        br i1 %tobool, label %while.end.loopexit, label %while.body
      
      while.end.loopexit:                               ; preds = %while.body
        %add.lcssa = phi double [ %add, %while.body ]
        br label %while.end
      
      while.end:                                        ; preds = %while.end.loopexit, %entry
        %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %while.end.loopexit ]
        %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
        ret void
      }
      ```
      IR before GVN after this patch:
      ```
      define dso_local void @foo(i32* nocapture readnone %r) local_unnamed_addr #0 {
      entry:
        %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16) #2
        %0 = bitcast i8* %call to %struct.__Node*
        %next = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 1
        store %struct.__Node* null, %struct.__Node** %next, align 8, !tbaa !2
        %f = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 0
        store double 1.150000e+01, double* %f, align 8, !tbaa !8
        %tobool12 = icmp eq i8* %call, null
        br i1 %tobool12, label %while.end, label %while.body.preheader
      
      while.body.preheader:                             ; preds = %entry
        br label %while.body
      
      while.body:                                       ; preds = %while.body.preheader, %while.body
        %sum.014 = phi double [ %add, %while.body ], [ 0.000000e+00, %while.body.preheader ]
        %ptr.013 = phi %struct.__Node* [ %2, %while.body ], [ %0, %while.body.preheader ]
        %f1 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 0
        %1 = load double, double* %f1, align 8, !tbaa !8
        %add = fadd contract double %sum.014, %1
        %next2 = getelementptr inbounds %struct.__Node, %struct.__Node* %ptr.013, i64 0, i32 1
        %2 = load %struct.__Node*, %struct.__Node** %next2, align 8, !tbaa !2
        %tobool = icmp eq %struct.__Node* %2, null
        br i1 %tobool, label %while.end.loopexit, label %while.body
      
      while.end.loopexit:                               ; preds = %while.body
        %add.lcssa = phi double [ %add, %while.body ]
        br label %while.end
      
      while.end:                                        ; preds = %while.end.loopexit, %entry
        %sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %while.end.loopexit ]
        %call3 = tail call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %sum.0.lcssa)
        ret void
      }
      ```
      
      The phi translation fails before this patch and it prevents GVN to remove the loop. The reason for this failure is in InstCombine. When the Instruction combining pass decides to convert:
      ```
       %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16)
        %0 = bitcast i8* %call to %struct.__Node*
        %next = getelementptr inbounds %struct.__Node, %struct.__Node* %0, i64 0, i32 1
        store %struct.__Node* null, %struct.__Node** %next
      ```
      to
      ```
      %call = tail call noalias dereferenceable_or_null(16) i8* @malloc(i64 16)
        %next = getelementptr inbounds i8, i8* %call, i64 8
        %0 = bitcast i8* %next to %struct.__Node**
        store %struct.__Node* null, %struct.__Node** %0
      
      ```
      
      GEP instructions with pure byte indexes (e.g. `getelementptr inbounds i8, i8* %call, i64 8`) are obstacles for address translation. address translation is looking for structural similarity between GEPs and these GEPs usually do not match since they have different structure.
      
      This change will cause couple of failures in LLVM-tests. However, in all cases we need to change expected result by the test. I will update those tests as soon as I get green light on this patch.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D96881
      302b80ab
    • Ricky Taylor's avatar
      [M68k] Add more specific operand classes · 8ef11122
      Ricky Taylor authored
      This change adds an operand class for each addressing mode, which can then
      be used as part of the assembler to match instructions.
      
      Differential Revision: https://reviews.llvm.org/D98535
      8ef11122
    • Min-Yih Hsu's avatar
      [M68k] Fixed incorrect `extract-section` command substitution · 340d558c
      Min-Yih Hsu authored
      Fix Bug 49485 (https://bugs.llvm.org/show_bug.cgi?id=49485). Which was
      caused by incorrect invocation of `extract-section.py` on Windows.
      Replacing it with more general python script invocation.
      
      Differential Revision: https://reviews.llvm.org/D98661
      340d558c
    • Martin Storsjö's avatar
      [compiler-rt] Use try_compile_only to check for __ARM_FP · cfb978d8
      Martin Storsjö authored
      This fixes detection when linking isn't supported (i.e. while building
      builtins the first time).
      
      Since 8368e4d5, after setting
      CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY, this isn't strictly
      needed, but is good for correctness anyway (and in case that commit
      ends up reverted).
      
      Differential Revision: https://reviews.llvm.org/D98737
      cfb978d8
    • River Riddle's avatar
      [mlir][PDL] Add support for variadic operands and results in the PDL byte code · 85ab413b
      River Riddle authored
      Supporting ranges in the byte code requires additional complexity, given that a range can't be easily representable as an opaque void *, as is possible with the existing bytecode value types (Attribute, Type, Value, etc.). To enable representing a range with void *, an auxillary storage is used for the actual range itself, with the pointer being passed around in the normal byte code memory. For type ranges, a TypeRange is stored. For value ranges, a ValueRange is stored. The above problem represents a majority of the complexity involved in this revision, the rest is adapting/adding byte code operations to support the changes made to the PDL interpreter in the parent revision.
      
      After this revision, PDL will have initial end-to-end support for variadic operands/results.
      
      Differential Revision: https://reviews.llvm.org/D95723
      85ab413b
    • River Riddle's avatar
      [mlir][PDL] Add support for variadic operands and results in the PDL Interpreter · 3a833a0e
      River Riddle authored
      This revision extends the PDL Interpreter dialect to add support for variadic operands and results, with ranges of these values represented via the recently added !pdl.range type. To support this extension, three new operations have been added that closely match the single variant:
      * pdl_interp.check_types : Compare a range of types with a known range.
      * pdl_interp.create_types : Create a constant range of types.
      * pdl_interp.get_operands : Get a range of operands from an operation.
      * pdl_interp.get_results : Get a range of results from an operation.
      * pdl_interp.switch_types : Switch on a range of types.
      
      This revision handles adding support in the interpreter dialect and the conversion from PDL to PDLInterp. Support for variadic operands and results in the bytecode will be added in a followup revision.
      
      Differential Revision: https://reviews.llvm.org/D95722
      3a833a0e
    • River Riddle's avatar
      [mlir][PDL] Add support for variadic operands and results in PDL · 1eb6994d
      River Riddle authored
      This revision extends the PDL dialect to add support for variadic operands and results, with ranges of these values represented via the recently added !pdl.range type. To support this extension, three new operations have been added that closely match the single variant:
      * pdl.operands : Define a range of input operands.
      * pdl.results : Extract a result group from an operation.
      * pdl.types : Define a handle to a range of types.
      
      Support for these in the pdl interpreter dialect and byte code will be added in followup revisions.
      
      Differential Revision: https://reviews.llvm.org/D95721
      1eb6994d
    • River Riddle's avatar
      [mlir][pdl] Remove CreateNativeOp in favor of a more general ApplyNativeRewriteOp. · 02c4c0d5
      River Riddle authored
      This has a numerous amount of benefits, given the overly clunky nature of CreateNativeOp:
      * Users can now call into arbitrary rewrite functions from inside of PDL, allowing for more natural interleaving of PDL/C++ and enabling for more of the pattern to be in PDL.
      * Removes the need for an additional set of C++ functions/registry/etc. The new ApplyNativeRewriteOp will use the same PDLRewriteFunction as the existing RewriteOp. This reduces the API surface area exposed to users.
      
      This revision also introduces a new PDLResultList class. This class is used to provide results of native rewrite functions back to PDL. We introduce a new class instead of using a SmallVector to simplify the work necessary for variadics, given that ranges will require some changes to the structure of PDLValue.
      
      Differential Revision: https://reviews.llvm.org/D95720
      02c4c0d5
    • River Riddle's avatar
      [mlir][pdl] Restructure how results are represented. · 242762c9
      River Riddle authored
      Up until now, results have been represented as additional results to a pdl.operation. This is fairly clunky, as it mismatches the representation of the rest of the IR constructs(e.g. pdl.operand) and also isn't a viable representation for operations returned by pdl.create_native. This representation also creates much more difficult problems when factoring in support for variadic result groups, optional results, etc. To resolve some of these problems, and simplify adding support for variable length results, this revision extracts the representation for results out of pdl.operation in the form of a new `pdl.result` operation. This operation returns the result of an operation at a given index, e.g.:
      
      ```
      %root = pdl.operation ...
      %result = pdl.result 0 of %root
      ```
      
      Differential Revision: https://reviews.llvm.org/D95719
      242762c9
    • Martin Storsjö's avatar
      [sanitizers] [windows] Use InternalMmapVector instead of silencing -Wframe-larger-than · 1bc8f5fb
      Martin Storsjö authored
      Also use this in ReadBinaryName which currently is producing
      warnings.
      
      Keep pragmas for silencing warnings in sanitizer_unwind_win.cpp,
      as that can be called more frequently.
      
      Differential Revision: https://reviews.llvm.org/D97726
      1bc8f5fb
    • Philip Reames's avatar
      [rs4gc] Simplify code by cloning existing instructions when inserting base chain [NFC] · cec9e735
      Philip Reames authored
      Previously we created a new node, then filled in the pieces. Now, we clone the existing node, then change the respective fields. The only change in handling is with phis since we have to handle multiple incoming edges from the same block a bit differently.
      
      Differential Revision: https://reviews.llvm.org/D98316
      cec9e735
    • Philip Reames's avatar
      [rs4gc] don't force a conflict for a canonical broadcast · ef884e15
      Philip Reames authored
      A broadcast is a shufflevector where only one input is used. Because of the way we handle constants (undef is a constant), the canonical shuffle sees a meet of (some value) and (nullptr). Given this, every broadcast gets treated as a conflict and a new base pointer computation is added.
      
      The other way to tackle this would be to change constant handling specifically for undefs, but this seems easier.
      
      Differential Revision: https://reviews.llvm.org/D98315
      ef884e15
    • Peter Collingbourne's avatar
      scudo: Allow TBI to be disabled on Linux with a macro. · db36d882
      Peter Collingbourne authored
      Android's native bridge (i.e. AArch64 emulator) doesn't support TBI so
      we need a way to disable TBI on Linux when targeting the native bridge.
      
      This can also be used to test the no-TBI code path on Linux (currently
      only used on Fuchsia), or make Scudo compatible with very old
      (pre-commit d50240a5f6ceaf690a77b0fccb17be51cfa151c2 from June 2013)
      Linux kernels that do not enable TBI.
      
      Differential Revision: https://reviews.llvm.org/D98732
      db36d882
    • Philip Reames's avatar
      [rs4gc] don't duplicate existing values which are provably base pointers · 5cabf472
      Philip Reames authored
      RS4GC needs to rewrite the IR to ensure that every relocated pointer has an associated base pointer. The existing code isn't particularly smart about avoiding duplication of existing IR when it turns out the original pointer we were asked to materialize a base pointer for is itself a base pointer.
      
      This patch adds a stage to the algorithm which prunes nodes proven (with a simple forward dataflow fixed point) to be base pointers from the list of nodes considered for duplication. This does require changing some of the later invariants slightly, that's probably the riskiest part of the change.
      
      Differential Revision: D98122
      5cabf472
    • Nikita Popov's avatar
    • Liam Keegan's avatar
      [MemCpyOpt] Add missing MemorySSAWrapperPass dependency macro · edf9565a
      Liam Keegan authored
      Add MemorySSAWrapperPass as a dependency to MemCpyOptLegacyPass,
      since MemCpyOpt now uses MemorySSA by default.
      
      Differential Revision: https://reviews.llvm.org/D98484
      edf9565a
    • Mircea Trofin's avatar
      [regalloc] Ensure Query::collectInterferringVregs is called before interval iteration · d40b4911
      Mircea Trofin authored
      The main part of the patch is the change in RegAllocGreedy.cpp: Q.collectInterferringVregs()
      needs to be called before iterating the interfering live ranges.
      
      The rest of the patch offers support that is the case: instead of  clearing the query's
      InterferingVRegs field, we invalidate it. The clearing happens when the live reg matrix
      is invalidated (existing triggering mechanism).
      
      Without the change in RegAllocGreedy.cpp, the compiler ices.
      
      This patch should make it more easily discoverable by developers that
      collectInterferringVregs needs to be called before iterating.
      
      I will follow up with a subsequent patch to improve the usability and maintainability of Query.
      
      Differential Revision: https://reviews.llvm.org/D98232
      d40b4911
Loading