1. Jun 27, 2021
  2. Jun 26, 2021
    • LLVM GN Syncbot's avatar
      [gn build] Port 8b7881a0 · b62de201
      LLVM GN Syncbot authored
      b62de201
    • mydeveloperday's avatar
      [clang-format] Add basic support for formatting JSON · 8b7881a0
      mydeveloperday authored
      I find as I develop I'm moving between many different languages C++,C#,JavaScript all the time. As I move between the file types I like to keep `clang-format` as my formatting tool of choice. (hence why I initially added C# support  in {D58404}) I know those other languages have their own tools but I have to learn them all, and I have to work out how to configure them, and they may or may not have integration into my IDE or my source code integration.
      
      I am increasingly finding that I'm editing additional JSON files as part of my daily work and my editor and git commit hooks are just not setup to go and run [[ https://stedolan.github.io/jq/ | jq ]], So I tend to go to  [[ https://jsonformatter.curiousconcept.com/ | JSON Formatter ]] and copy and paste back and forth. To get nicely formatted JSON. This is a painful process and I'd like a new one that causes me much less friction.
      
      This has come up from time to time:
      
      {D10543}
      https://stackoverflow.com/questions/35856565/clang-format-a-json-file
      https://bugs.llvm.org/show_bug.cgi?id=18699
      
      I would like to stop having to do that and have formatting JSON as a first class clang-format support `Language` (even if it has minimal style settings at present).
      
      This revision adds support for formatting JSON using the inbuilt JSON serialization library of LLVM, With limited control at present only over the indentation level
      
      This adds an additional Language into the .clang-format file to separate the settings from your other supported languages.
      
      Reviewed By: HazardyKnusperkeks
      
      Differential Revision: https://reviews.llvm.org/D93528
      8b7881a0
    • mydeveloperday's avatar
      [clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace · 37c22330
      mydeveloperday authored
      https://bugs.llvm.org/show_bug.cgi?id=50702
      
      I believe {D44609} may be too aggressive with brace wrapping rules which doesn't always apply to Lamdbas
      
      The introduction of BeforeLambdaBody and AllowShortLambdasOnASingleLine has impact on brace handling on other block types, which I suspect we didn't see before as people may not be using the BeforeLambdaBody  style
      
      From what I can tell this can be seen by the unit test I change as its not honouring the orginal LLVM brace wrapping style for the `Fct()` function
      
      I added a unit test from PR50702 and have removed some of the code (which has zero impact on the unit test, which kind of suggests its unnecessary), some additional attempt has been made to try and ensure we'll only break on what is actually a LamdbaLBrace
      
      Reviewed By: HazardyKnusperkeks
      
      Differential Revision: https://reviews.llvm.org/D104222
      37c22330
    • mydeveloperday's avatar
      [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations · ee3b2c47
      mydeveloperday authored
      https://bugs.llvm.org/show_bug.cgi?id=50525
      
      AlignConsecutiveAssignments/Declarations cause incorrect alignment in the presence of a DesignatedInitializerPeriod (https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)
      
      ```
      static NTSTATUS stg(PLW_STREAM Stream, int identity)
      {
           NTSTATUS             status;
           BYTE                 payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
           struct dm_rpc_header header       = {.drh_magic        = DRH_MAGIC,
                                          .drh_op_code      = RPC_OP_ECHO,
                                          .drh_payload_size = sizeof(payload),
                                          .drh_body_size    = sizeof(payload),
                                          .drh_request_id   = 1};
           header.drh_version                = identity;
      ```
      
      This fix addresses that by ensuring the period isn't ignored
      
      Reviewed By: HazardyKnusperkeks
      
      Differential Revision: https://reviews.llvm.org/D104900
      ee3b2c47
    • David Green's avatar
    • Florian Hahn's avatar
      [LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC). · 7f369819
      Florian Hahn authored
      Suggested in D104197, avoids the early exit.
      7f369819
    • LLVM GN Syncbot's avatar
      [gn build] Port aff57ff2 · 2b901674
      LLVM GN Syncbot authored
      2b901674
    • Lang Hames's avatar
      [JITLink][ELF] Add generic ELFLinkGraphBuilder template. · aff57ff2
      Lang Hames authored
      ELFLinkGraphBuilder<ELFT> will hold generic parsing and LinkGraph-building code
      that can be shared between JITLink ELF backends for different architectures.
      
      For now it's just a stub. The plan is to incrementally move functionality down
      from ELFLinkGraphBuilder_x86_64 into the new template.
      aff57ff2
    • Timm Bäder's avatar
      [clang][tests] Specify unwindlib in aix-ld tests · 3255db49
      Timm Bäder authored
      Clang can be configured with a different default unwindlib, for example
      gcc. In that case, -lunwind will not be present in the output.
      
      Fix this by explicitly specifying libunwind as the unwindlib.
      
      Differential Revision: https://reviews.llvm.org/D104899
      3255db49
    • Jim Lin's avatar
      [RISCV][NFC] Combine the control flow for different RetOp of interrupt function · 779d2b0a
      Jim Lin authored
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D104838
      779d2b0a
    • Saurabh Jha's avatar
      [Docs] Minor fixes with language extension docs · c8f3f46c
      Saurabh Jha authored
      There were some issues in the patch https://reviews.llvm.org/D104198. I also forgot to address one comment. This patch addresses these.
      
      Reviewed By: xgupta
      
      Differential Revision: https://reviews.llvm.org/D104971
      c8f3f46c
    • Craig Topper's avatar
      [RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend... · d4f4a1ba
      Craig Topper authored
      [RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend (i32 X)) with sign_extend.
      
      If type legalization is going to insert a sign_extend for other users
      of X and we can fold the sign_extend into ADDW/MULW/SUBW, it is
      better to replace the ANY_EXTEND so we don't end up with a separate
      ADD/MUL/SUB instruction for the users of the ANY_EXTEND.
      
      I'm only handling setcc uses right now, but there are other
      instructions that force sign_extends like ashr.
      
      There are probably other *W instructions we could use in addition
      to ADDW/SUBW/MULW.
      
      My motivating case was a loop terminating compare and a phi use
      as seen in the new test file.
      
      Reviewed By: asb
      
      Differential Revision: https://reviews.llvm.org/D104581
      d4f4a1ba
    • Gus Smith's avatar
      [MLIR][Sparse] Move `buildLattices` into Merger · 043ce4e6
      Gus Smith authored
      This allows us to use `buildLattices` in the `Merger` unittests.
      
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D104879
      043ce4e6
    • Eric Astor's avatar
      [ms] [llvm-ml] Disable C-style comments · e074d580
      Eric Astor authored
      e074d580
    • Luo, Yuanke's avatar
      [X86] Selecting fld0 for undefined value in fast ISEL. · 36003c20
      Luo, Yuanke authored
      When set opt-bisect-limit to some value that is less than ISel pass
      in command line and CurBisectNum expired, "DAG to DAG" pass lower
      its opt level to O0. However "processimpdefs" and "X86 FP Stackifier"
      is not stopped due to the CurBisectNum expiration. So undefined fp0
      is generated. This cause crash in the "X86 FP Stackifier" pass,
      because Stackifier doesn't expect any undefined fp value.
      
      Here is the scenario that cause compiler crash.
      
        successors: %bb.26
        liveins: $r14
          ST_FPrr $st0, implicit-def $fpsw, implicit $fpcw
          renamable $rdi = MOV64ri @.str.3.16422
          renamable $rdx = LEA64r %stack.6, 1, $noreg, 0, $noreg
          ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def dead
          $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
          dead $esi = MOV32r0 implicit-def dead $eflags, implicit-def $rsi
          CALL64pcrel32 @foo, implicit $rsp, implicit $ssp, implicit $rdi,
          implicit $rsi, implicit $rdx, implicit-def dead $fp0
          renamable $xmm0 = MOVSDrm_alt %stack.10, 1, $noreg, 0, $noreg :: (load 8
          from %stack.10)
          ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def dead $eflags,
          implicit-def $ssp, implicit $rsp, implicit $ssp
          renamable $fp2 = CHS_Fp80 killed undef renamable $fp0, implicit-def
          $fpsw
          JMP_1 %bb.26
      The CALL64pcrel32 mark fp0 dead, so llvm free the stack slot for fp0
      and the stack become empty. In the late instruction CHS_Fp80, it use
      undefined register fp0, the original code assume there must be a stack
      slot for the src register (fp0) without respecting it is undefined,
      so llvm report error.
      
      We have some discussion in https://reviews.llvm.org/D104440 and we
      decide to fix it in fast ISel. The fix is to lower undefined fp value to
      zero value, so that it release the burden of "X86 FP Stackifier" pass.
      Thank Craig for the suggestion and the initial patch to fix it.
      
      Differential Revision: https://reviews.llvm.org/D104678
      36003c20
    • Jon Chesterfield's avatar
      Disable ReplaceLDS pass, patch up tests to match · 50ad3478
      Jon Chesterfield authored
      Most tests passed with an extra argument to explicitly enable the pass.
      One does not, deleted it as part of this change. I can't see why the codegen
      would be different between default on and default off but switched on. It
      can be retrieved from the project history.
      
      This would be a revert, but git revert was not clean. Disabling the pass
      and leaving it in tree is less likely to cause breakage elsewhere than
      patching up the git revert conflicts on unfamiliar code. It'll be landed
      without review, as @hsmhsm is believed unavailable at present.
      
      Differential Revision: https://reviews.llvm.org/D104962
      50ad3478
    • Andrew Browne's avatar
      [DFSan] Change shadow and origin memory layouts to match MSan. · 45f6d552
      Andrew Browne authored
      Previously on x86_64:
      
        +--------------------+ 0x800000000000 (top of memory)
        | application memory |
        +--------------------+ 0x700000008000 (kAppAddr)
        |                    |
        |       unused       |
        |                    |
        +--------------------+ 0x300000000000 (kUnusedAddr)
        |       origin       |
        +--------------------+ 0x200000008000 (kOriginAddr)
        |       unused       |
        +--------------------+ 0x200000000000
        |   shadow memory    |
        +--------------------+ 0x100000008000 (kShadowAddr)
        |       unused       |
        +--------------------+ 0x000000010000
        | reserved by kernel |
        +--------------------+ 0x000000000000
      
        MEM_TO_SHADOW(mem) = mem & ~0x600000000000
        SHADOW_TO_ORIGIN(shadow) = kOriginAddr - kShadowAddr + shadow
      
      Now for x86_64:
      
        +--------------------+ 0x800000000000 (top of memory)
        |    application 3   |
        +--------------------+ 0x700000000000
        |      invalid       |
        +--------------------+ 0x610000000000
        |      origin 1      |
        +--------------------+ 0x600000000000
        |    application 2   |
        +--------------------+ 0x510000000000
        |      shadow 1      |
        +--------------------+ 0x500000000000
        |      invalid       |
        +--------------------+ 0x400000000000
        |      origin 3      |
        +--------------------+ 0x300000000000
        |      shadow 3      |
        +--------------------+ 0x200000000000
        |      origin 2      |
        +--------------------+ 0x110000000000
        |      invalid       |
        +--------------------+ 0x100000000000
        |      shadow 2      |
        +--------------------+ 0x010000000000
        |    application 1   |
        +--------------------+ 0x000000000000
      
        MEM_TO_SHADOW(mem) = mem ^ 0x500000000000
        SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000
      
      Reviewed By: stephan.yichao.zhao, gbalats
      
      Differential Revision: https://reviews.llvm.org/D104896
      45f6d552
    • Siva Chandra Reddy's avatar
      [libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h. · 2e9c75da
      Siva Chandra Reddy authored
      __builtin_ctzl takes an unsigned long argument which need not be 64-bit
      long on all platforms. Using __builtin_ctzll, which takes an unsigned
      long long argument, ensures that 64-bit values will be handled on a
      wider range of platforms.
      
      Without this change, the test corresponding to M512 fails in Windows.
      
      Reviewed By: gchatelet
      
      Differential Revision: https://reviews.llvm.org/D104897
      2e9c75da
    • Nikita Popov's avatar
      Revert "[InstCombine] Make indexed compare fold opaque ptr compatible" · fdd4c199
      Nikita Popov authored
      This reverts commit 5cb20ef8.
      
      Assertion failures with this patch were reported on
      https://reviews.llvm.org/rG5cb20ef8a235, revert for now.
      fdd4c199
    • Duncan P. N. Exon Smith's avatar
      OpaquePtr: Reject 'ptr*' again when parsing textual IR · 4506f614
      Duncan P. N. Exon Smith authored
      Bring back the testcase dropped in
      1e6303e6 and get it passing by checking
      explicitly for `ptr*` in LLParser. Uses `Type::isOpaquePointerTy()` from
      ad4bb828.
      
      Differential Revision: https://reviews.llvm.org/D104938
      4506f614
    • Aart Bik's avatar
      [mlir][sparse] add print methods to Merger (for debugging) · 557b101c
      Aart Bik authored
      Reviewed By: gussmith23
      
      Differential Revision: https://reviews.llvm.org/D104939
      557b101c
    • Matheus Izvekov's avatar
      [clang] Stop providing builtin overload candidate for relational function pointer comparisons · ad14b5b0
      Matheus Izvekov authored
      
      
      Word on the grapevine was that the committee had some discussion that
      ended with unanimous agreement on eliminating relational function pointer comparisons.
      
      We wanted to be bold and just ban all of them cold turkey.
      But then we chickened out at the last second and are going for
      eliminating just the spaceship overload candidate instead, for now.
      
      See D104680 for reference.
      
      This should be fine and "safe", because the only possible semantic change this
      would cause is that overload resolution could possibly be ambiguous if
      there was another viable candidate equally as good.
      
      But to save face a little we are going to:
      * Issue an "error" for three-way comparisons on function pointers.
        But all this is doing really is changing one vague error message,
        from an "invalid operands to binary expression" into an
        "ordered comparison of function pointers", which sounds more like we mean business.
      * Otherwise "warn" that comparing function pointers like that is totally
        not cool (unless we are told to keep quiet about this).
      
      Signed-off-by: default avatarMatheus Izvekov <mizvekov@gmail.com>
      
      Reviewed By: rsmith
      
      Differential Revision: https://reviews.llvm.org/D104892
      ad14b5b0
    • Jonas Devlieghere's avatar
      [lldb] Use the non-locking variant of objc_copyRealizedClassList · ffc05338
      Jonas Devlieghere authored
      Avoid standing the Objective-C runtime lock by calling
      objc_copyRealizedClassList_nolock instead of objc_copyRealizedClassList.
      
      We already guarantee that no other threads can run while we're running
      this utility expression, similar to when we parse the data ourselves
      from the gdb_objc_realized_classes struct.
      
      Worst case this will crash if the list is getting edited, which won't do
      any harm and we'll just try again later.
      
      Differential revision: https://reviews.llvm.org/D104951
      ffc05338
    • Jim Ingham's avatar
      Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM" · 4eabb120
      Jim Ingham authored
      This was an oversight of the commit: bb93483c that
      added support for the Frozen variants.  Also added a test case for the way that
      currently produces one of these variants (a copy).
      4eabb120
    • Eli Friedman's avatar
      [NFC] Prefer ConstantRange::makeExactICmpRegion over makeAllowedICmpRegion · 8d5bf070
      Eli Friedman authored
      The implementation is identical, but it makes the semantics a bit more
      obvious.
      8d5bf070