1. Jul 26, 2019
    • Simon Pilgrim's avatar
      [TargetLowering] SimplifyMultipleUseDemandedBits - add BITCAST pass through support. · b32ceb79
      Simon Pilgrim authored
      This allows us to peek through BITCASTs and attempt simplify the source operand, and then bitcast back.
      
      llvm-svn: 367091
      b32ceb79
    • Fangrui Song's avatar
      ObjectFileELF: Use llvm::JamCRC to refactor CRC32 computation · 20db94b7
      Fangrui Song authored
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D65318
      
      llvm-svn: 367090
      20db94b7
    • Sam Parker's avatar
      [ARM][LowOverheadLoops] Add CPSR defs · c760b5da
      Sam Parker authored
      Both WhileLoopStart and LoopEnd may get turned into a cmp and br pair,
      so add an implicit def to these pseudo instructions in case that WLS
      and LE aren't generated.
      
      Differential Revision: https://reviews.llvm.org/D65275
      
      llvm-svn: 367089
      c760b5da
    • Pengfei Wang's avatar
      [WinEH] Allocate space in funclets stack to save XMM CSRs · 9ad565f7
      Pengfei Wang authored
      Summary:
      This is an alternate approach to D57970.
      Currently funclets reuse the same stack slots that are used in the
      parent function for saving callee-saved xmm registers. If the parent
      function modifies a callee-saved xmm register before an excpetion is
      thrown, the catch handler will overwrite the original saved value.
      
      This patch allocates space in funclets stack for saving callee-saved xmm
      registers and uses RSP instead RBP to access memory.
      
      Reviewers: andrew.w.kaylor, LuoYuanke, annita.zhang, craig.topper,
      RKSimon
      
      Subscribers: rnk, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D63396
      
      
      
      Signed-off-by: default avatarpengfei <pengfei.wang@intel.com>
      llvm-svn: 367088
      9ad565f7
    • Serguei Katkov's avatar
      [Loop Utils] Extend the scope of addStringMetadataToLoop. · 7f8c8095
      Serguei Katkov authored
      To avoid duplicates in loop metadata, if the string to add is
      already there, just update the value.
      
      Reviewers: reames, Ashutosh
      Reviewed By: reames
      Subscribers: hiraditya, llvm-commits
      Differential Revision: https://reviews.llvm.org/D65265
      
      llvm-svn: 367087
      7f8c8095
    • Pavel Labath's avatar
      SymbolVendor: Move Symtab construction into the SymbolFile · 84a68569
      Pavel Labath authored
      Summary:
      Instead of having SymbolVendor coordinate Symtab construction between
      Symbol and Object files, make the SymbolVendor function a passthrough,
      and put all of the logic into the SymbolFile.
      
      Reviewers: clayborg, JDevlieghere, jingham, espindola
      
      Subscribers: emaste, mgorny, arichardson, MaskRay, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D65208
      
      llvm-svn: 367086
      84a68569
    • Serguei Katkov's avatar
      [Loop Utils] Move utilty addStringMetadataToLoop to LoopUtils.cpp. NFC. · 3c3a7652
      Serguei Katkov authored
      Just move the utility function to LoopUtils.cpp to re-use it in loop peeling.
      
      Reviewers: reames, Ashutosh
      Reviewed By: reames
      Subscribers: hiraditya, asbirlea, llvm-commits
      Differential Revision: https://reviews.llvm.org/D65264
      
      llvm-svn: 367085
      3c3a7652
    • Yi Kong's avatar
      Fix macOS build after r358716 · 1755abe1
      Yi Kong authored
      COPYFILE_CLONE is only defined on newer macOS versions, using it without
      check breaks build on systems running legacy OS and toolchain.
      
      Differential Revision: https://reviews.llvm.org/D65317
      
      llvm-svn: 367084
      1755abe1
    • Kang Zhang's avatar
      Some case eror for: detected memory leaks · 4e794a8b
      Kang Zhang authored
      llvm-svn: 367083
      4e794a8b
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Handle most function return types · a9ea8a9a
      Matt Arsenault authored
      handleAssignments gives up pretty easily on structs, and i8 values for
      some reason. The other case that doesn't work is when an implicit sret
      needs to be inserted if the return size exceeds the number of return
      registers.
      
      llvm-svn: 367082
      a9ea8a9a
    • Matt Arsenault's avatar
      GlobalISel: Fold out unmerge to scalars from concat_vector · 51d795d9
      Matt Arsenault authored
      Removes illegal intermediate vectors if an operation was lowering to
      concat_vectors, and the next operation is scalarized.
      
      llvm-svn: 367081
      51d795d9
    • Kang Zhang's avatar
      [PowerPC] Do the Simple Early Return in block-placement pass to optimize the blocks · 5c610154
      Kang Zhang authored
      Summary:
      In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
      But the `early-ret` pass is before `block-placement`, we don't want to run it again.
      This patch is to do the simple early return to optimize the blocks at the last of `block-placement`. 
      
      Below is an example
      ```
      BB:                   | BB:
         XOR 3, 3, 4        |   XOR 3, 3, 4
         B TBB              |   B ChainBB
      ...                   | ...
      ChainBB:              | ChainBB:
         B TBB              |   ADD 3, 3, 4
      ...                   |   BLR
      TBB:                  |
         ADD 3, 3, 4        |
         BLR                |
      ```
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D63972
      
      llvm-svn: 367080
      5c610154
    • Jonas Devlieghere's avatar
      [dotest] Remove dead code · 5620e753
      Jonas Devlieghere authored
      Remove some dead code that I ran into when preparing D65311.
      
      llvm-svn: 367079
      5620e753
    • Francis Visoiu Mistrih's avatar
      Reland: [Remarks] Add support for serializing metadata for every remark streamer · 2d8fdcae
      Francis Visoiu Mistrih authored
      This allows every serializer format to implement metaSerializer() and
      return the corresponding meta serializer.
      
      Original llvm-svn: 366946
      Reverted llvm-svn: 367004
      
      This fixes the unit tests on Windows bots.
      
      llvm-svn: 367078
      2d8fdcae
    • Jonas Devlieghere's avatar
      [Tests] Split inferior crashing tests · 32211fda
      Jonas Devlieghere authored
      We noticed that TestInferiorCrashing.py and TestRecursiveInferior.py are
      the second and third slowest tests in the test suite. Splitting them up
      allows lit to schedule them more effectively.
      
      llvm-svn: 367077
      32211fda
    • Akira Hatanaka's avatar
      Revert "[Sema] Diagnose default-initialization, destruction, and copying of" · 6f6156b9
      Akira Hatanaka authored
      This reverts commit r365985.
      
      Prior to r365985, clang used to mark C union fields that have
      non-trivial ObjC ownership qualifiers as unavailable if the union was
      declared in a system header. r365985 stopped doing so, which caused the
      swift compiler to crash when it tried to import a non-trivial union.
      
      I have a patch that fixes the crash (https://reviews.llvm.org/D65256),
      but I'm temporarily reverting the original patch until we can decide on
      whether it's taking the right approach.
      
      llvm-svn: 367076
      6f6156b9
    • Amara Emerson's avatar
      c07fe307
    • Diego Astiazaran's avatar
      [clang-doc] Fix failing tests on Windows · 30ca2828
      Diego Astiazaran authored
      Tests on Windows were failing due to path separator differences.
      '/' was being used as separator in the expected output, paths in expected output are now changed to their native form before comparing them to the actual output.
      
      Differential Revision: https://reviews.llvm.org/D65306
      
      llvm-svn: 367074
      30ca2828
    • Jonas Devlieghere's avatar
      [CMake] Add TableGen dependency to lldbInterpreter. · a5db339c
      Jonas Devlieghere authored
      lldbInterpreter depends on LLDBPropertiesGen and LLDBPropertiesEnumGen.
      
      llvm-svn: 367073
      a5db339c
    • Diego Astiazaran's avatar
      [clang-doc] Add option for user provided stylesheets · acd35f6c
      Diego Astiazaran authored
      An option has been added to clang-doc to provide a list of css stylesheets that the user wants to use for the generated html docs.
      
      Depends on D64539.
      
      Differential Revision: https://reviews.llvm.org/D64938
      
      llvm-svn: 367072
      acd35f6c
    • Tom Roeder's avatar
      [clang-tidy] Add a module for the Linux kernel. · fc8c65b2
      Tom Roeder authored
      Summary:
      Now that clang is going to be able to build the Linux kernel again on
      x86, and we have gen_compile_commands.py upstream for generating
      compile_commands.json, clang-tidy can be used on the Linux kernel
      source.
      
      To that end, this commit adds a new clang-tidy module to be used for
      checks specific to Linux kernel source. The Linux kernel follows its own
      style of C, and it will be useful to separate those checks into their
      own module.
      
      This also adds an initial check that makes sure that return values from
      the kernel error functions like PTR_ERR and ERR_PTR are checked. It also
      makes sure that any functions that directly return values from these
      functions are checked.
      
      Subscribers: xazax.hun, gribozavr, Eugene.Zelenko, lebedev.ri, mgorny, jdoerfert, cfe-commits
      
      Tags: #clang, #clang-tools-extra
      
      Reviewers: aaron.ballman, alexfh, hokein, JonasToth
      
      Differential Revision: https://reviews.llvm.org/D59963
      
      llvm-svn: 367071
      fc8c65b2
    • Yi Kong's avatar
      [openmp] Workaround bug in old Android pthread_attr_setstacksize · 3d21a3af
      Yi Kong authored
      Round the stack size to a multiple of the page size. Older versions of
      Android (until KitKat) would fail pthread_attr_setstacksize with
      EINVAL if the stack size was not a multiple of the page size.
      
      Patch by Dan Albert <danalbert@google.com>.
      
      Test: Build, copied into the NDK, passed openmp test on ICS.
      Bug: https://github.com/android-ndk/ndk/issues/9
      llvm-svn: 367070
      3d21a3af
    • Sanjay Patel's avatar
      [InstCombine] add tests for lerp patterns (PR42716); NFC · 8f15d405
      Sanjay Patel authored
      llvm-svn: 367069
      8f15d405
    • Francis Visoiu Mistrih's avatar
      [CodeGen] Don't resolve the stack protector frame accesses until PEI · 0503add6
      Francis Visoiu Mistrih authored
      Currently, stack protector loads and stores are resolved during
      LocalStackSlotAllocation (if the pass needs to run). When this is the
      case, the base register assigned to the frame access is going to be one
      of the vregs created during LocalStackSlotAllocation. This means that we
      are keeping a pointer to the stack protector slot, and we're using this
      pointer to load and store to it.
      
      In case register pressure goes up, we may end up spilling this pointer
      to the stack, which can be a security concern.
      
      Instead, leave it to PEI to resolve the frame accesses. In order to do
      that, we make all stack protector accesses go through frame index
      operands, then PEI will resolve this using an offset from sp/fp/bp.
      
      Differential Revision: https://reviews.llvm.org/D64759
      
      llvm-svn: 367068
      0503add6
    • George Burgess IV's avatar
      [Sema] add -Walloca to flag uses of `alloca` · 9d045a5c
      George Burgess IV authored
      This CL adds an optional warning to diagnose uses of the
      `__builtin_alloca` family of functions. The use of these functions is
      discouraged by many, so it seems like a good idea to allow clang to warn
      about it.
      
      Patch by Elaina Guan!
      
      Differential Revision: https://reviews.llvm.org/D64883
      
      llvm-svn: 367067
      9d045a5c
    • Jonas Devlieghere's avatar
      [Docs] Remove reproducers from the project page. · 29af3b4e
      Jonas Devlieghere authored
      Jim pointed out that this was still open on the website.
      
      llvm-svn: 367066
      29af3b4e
    • Jonas Devlieghere's avatar
      [Tablegen] Fix issues caused by incorrect escaping. · 7296fac5
      Jonas Devlieghere authored
      The printEscapedString would escape newlines by their ASCII values
      instead of prefixing them with a `\`. Remove the escaping logic and
      escape the strings in the definition file.
      
      llvm-svn: 367065
      7296fac5
    • Pirama Arumuga Nainar's avatar
      [profile] In Android, do not mkdir() dirs in GCOV_PREFIX · 6caa8da0
      Pirama Arumuga Nainar authored
      Summary:
      In Android, attempting to mkdir() or even stat() top-level directories
      like /data causes noisy selinux denials.  During whole-system coverage
      instrumentation, this causes a deluge of noisy messages that drown out
      legitimate selinux denials, that should be audited and fixed.
      
      To avoid this, skip creating any directory in GCOV_PREFIX (thereby
      assuming that it exists).
      
      - Android platform ensures that the GCOV_PREFIX used in Android is
      created and read/writable by all processes.
      - This only affects the Android platform (by checking against
      __ANDROID_API_FUTURE__) and for apps built with Clang coverage, the
      runtime will still create any non-existent parent directories for the
      coverage files.
      
      Reviewers: srhines, davidxl
      
      Subscribers: krytarowski, #sanitizers, danalbert, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D65245
      
      llvm-svn: 367064
      6caa8da0
    • Puyan Lotfi's avatar
      [NFC][clang] Refactor getCompilationPhases()+Types.def step 2. · c07c83b1
      Puyan Lotfi authored
      - Removing a few of the entries in the Flags for the Types.def table.
      - Removing redundant parts of getCompilationPhases().
      
      Flags have been removed from Types.def:
      
       a - The type should only be assembled: Now, check that Phases contains
           phases::Assemble but not phases::Compile or phases::Backend.
       p - The type should only be precompiled: Now, check that Phases contains
           phases::Precompile but that Flags does not contain 'm'.
       m - Precompiling this type produces a module file: Now, check that
           isPrepeocessedModuleType.
      
      
      
      Differential Revision: https://reviews.llvm.org/D65176
      
      llvm-svn: 367063
      c07c83b1
    • Yonghong Song's avatar
      [BPF] fix typedef issue for offset relocation · 329abf29
      Yonghong Song authored
      
      
      Currently, the CO-RE offset relocation does not work
      if any struct/union member or array element is a typedef.
      For example,
        typedef const int arr_t[7];
        struct input {
            arr_t a;
        };
        func(...) {
             struct input *in = ...;
             ... __builtin_preserve_access_index(&in->a[1]) ...
        }
      The BPF backend calculated default offset is 0 while
      4 is the correct answer. Similar issues exist for struct/union
      typedef's.
      
      When getting struct/union member or array element type,
      we should trace down to the type by skipping typedef
      and qualifiers const/volatile as this is what clang did
      to generate getelementptr instructions.
      (const/volatile member type qualifiers are already
      ignored by clang.)
      
      This patch fixed this issue, for each access index,
      skipping typedef and const/volatile/restrict BTF types.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      
      Differential Revision: https://reviews.llvm.org/D65259
      
      llvm-svn: 367062
      329abf29
    • Alex Lorenz's avatar
      [FileCollector] add support for recording empty directories · b680422e
      Alex Lorenz authored
      The file collector class is useful for constructing reproducers by
      creating a snapshot of the files that are accessed. Sometimes it might
      also be important to construct directories that don't necessarily have files,
      but are still accessed by some tool that we want to make a reproducer for.
      This is useful for instance for modeling the behavior of Clang's header search,
      which scans through a number of directories it doesn't actually access when
      looking for framework headers. This commit extends the file collector to allow
      it to work with paths that are just directories, by constructing them as the
      files are copied over.
      
      Differential Revision: https://reviews.llvm.org/D65297
      
      llvm-svn: 367061
      b680422e
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Fix G_SELECT legalization fallback after r366943. · e54dc6b8
      Amara Emerson authored
      Changes the order of legalization of G_ICMP suggested by Petar in D65079.
      
      llvm-svn: 367060
      e54dc6b8
    • Jim Ingham's avatar
      Mention adding predicates to settings in the projects page. · 2b6afdf7
      Jim Ingham authored
      llvm-svn: 367059
      2b6afdf7
    • Jonas Devlieghere's avatar
      Let tablegen generate property definitions · 971f9ca6
      Jonas Devlieghere authored
      Property definitions are currently defined in a PropertyDefinition array
      and have a corresponding enum to index in this array. Unfortunately this
      is quite error prone. Indeed, just today we found an incorrect merge
      where a discrepancy between the order of the enum values and their
      definition caused the test suite to fail spectacularly.
      
      Tablegen can streamline the process of generating the property
      definition table while at the same time guaranteeing that the enums stay
      in sync. That's exactly what this patch does. It adds a new tablegen
      file for the properties, building on top of the infrastructure that
      Raphael added recently for the command options. It also introduces two
      new tablegen backends: one for the property definitions and one for
      their corresponding enums.
      
      It might be worth mentioning that I generated most of the tablegen
      definitions from the existing property definitions, by adding a dump
      method to the struct. This seems both more efficient and less error
      prone that copying everything over by hand. Only Enum properties needed
      manual fixup for the EnumValues and DefaultEnumValue fields.
      
      Differential revision: https://reviews.llvm.org/D65185
      
      llvm-svn: 367058
      971f9ca6
    • Jim Ingham's avatar
      Remove a project that was completed. · d16a034c
      Jim Ingham authored
      llvm-svn: 367057
      d16a034c
    • Diego Astiazaran's avatar
      [clang-doc] Add stylesheet to generated html docs · db5d8e3d
      Diego Astiazaran authored
      A default css stylesheet is included for docs generated in html format.
      
      Differential Revision: https://reviews.llvm.org/D64539
      
      llvm-svn: 367056
      db5d8e3d
    • Saleem Abdulrasool's avatar
      Revert "Revert "CodeGen: ensure placeholder instruction for cleanup is created"" · 3bdb7a90
      Saleem Abdulrasool authored
      This reverts commit fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19.
      
      Add an explicit triple for the test which is pattern matching overly
      aggressively.
      
      llvm-svn: 367055
      3bdb7a90
    • Jonas Devlieghere's avatar
      [dotest] Set environment variables after potentialy clearing others. · 2fa67f44
      Jonas Devlieghere authored
      Dotest contains code to clear DYLD_LIBRARY_PATH for the inferior to not
      propagate sanitized builds. However, it's possible that we want to
      inject a different library path with `--inferior-env`. To make that work
      correctly, we need to do that *after* clearing DYLD_LIBRARY_PATH.
      
      llvm-svn: 367054
      2fa67f44
    • Leonard Chan's avatar
      Reland the "[NewPM] Port Sancov" patch from rL365838. No functional · 007f674c
      Leonard Chan authored
      changes were made to the patch since then.
      
      --------
      
      [NewPM] Port Sancov
      
      This patch contains a port of SanitizerCoverage to the new pass manager. This one's a bit hefty.
      
      Changes:
      
      - Split SanitizerCoverageModule into 2 SanitizerCoverage for passing over
        functions and ModuleSanitizerCoverage for passing over modules.
      - ModuleSanitizerCoverage exists for adding 2 module level calls to initialization
        functions but only if there's a function that was instrumented by sancov.
      - Added legacy and new PM wrapper classes that own instances of the 2 new classes.
      - Update llvm tests and add clang tests.
      
      llvm-svn: 367053
      007f674c
    • Antonio Afonso's avatar
      [LLDB] Find debugserver in Command Line Tools as well · 9294c872
      Antonio Afonso authored
      Summary:
      This might be an edge case in regular use but if you're shipping an lldb version with no debugserver lldb will try to use the System one.
      However, lldb only knows how to find the Xcode one and not the Command Line Tools one. This diff fixes that.
      
      We try to find debugserver with `PlatformDarwin::LocateExecutable("debugserver")`, we call `xcode-select -p` to get the path and then assume this path is of Xcode.
      
      The changes I did are:
      * Change `PlatformDarwin::LocateExecutable` to also add the Command Line Tools directory to the list of paths to search for debugserver.
      * Created a new function to find the Command Line Tools directory named `GetCommandLineToolsLibraryPath`.
      * Refactored the code that calls `xcode-select -p` into its own function `GetXcodeSelectPath()`. There were 2 identical pieces of code for this so I reduced it to one and used this function everywhere instead.
      * I also changed `PlatformDarwin::GetSDKDirectoryForModules` to use the `SDKs` directory that exists in the Command Line Tools installation.
      
      I'm not sure how to create tests for this. PlatformDarwinTest is really limited and I couldn't find how to mock Filesystem::Instance() so I could create a virtual file system.
      
      Reviewers: clayborg, JDevlieghere
      
      Reviewed By: clayborg, JDevlieghere
      
      Subscribers: jasonmolenda, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D65171
      
      llvm-svn: 367052
      9294c872