1. Jun 30, 2017
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Fix test for revision D29645. NFC · 7916da23
      Gheorghe-Teodor Bercea authored
       
      
      llvm-svn: 306724
      7916da23
    • Alexandre Isoard's avatar
      Reverting r306695 while investigating failing test case. · 41044876
      Alexandre Isoard authored
      Failing test case:
          Transforms/LoopVectorize.iv_outside_user.ll
      
      llvm-svn: 306723
      41044876
    • Akira Hatanaka's avatar
      [Sema] Issue diagnostics if a new/delete expression generates a call to · cae83f78
      Akira Hatanaka authored
      a c++17 aligned allocation/deallocation function that is unavailable in
      the standard library on Apple platforms.
      
      The aligned functions are implemented only in the following versions or
      later versions of the OSes, so clang issues diagnostics if the deployment
      target being targeted is older than these:
      
      macosx: 10.13
      ios: 11.0
      tvos: 11.0
      watchos: 4.0
      
      The diagnostics are issued whenever the aligned functions are selected
      except when the selected function has a definition in the same file.
      If there is a user-defined function available somewhere else, option
      -Wno-aligned-allocation-unavailable can be used to silence the
      diagnostics.
      
      rdar://problem/32664169
      
      Differential Revision: https://reviews.llvm.org/D34574
      
      llvm-svn: 306722
      cae83f78
    • Yaxun Liu's avatar
      CodeGen: Fix invalid bitcast for coerced function argument · e9e5c4f9
      Yaxun Liu authored
      Clang assumes coerced function argument is in address space 0, which is not always true and results in invalid bitcasts.
      
      This patch fixes failure in OpenCL conformance test api/get_kernel_arg_info with amdgcn---amdgizcl triple, where non-zero alloca address space is used.
      
      Differential Revision: https://reviews.llvm.org/D34777
      
      llvm-svn: 306721
      e9e5c4f9
    • Brian Gesiak's avatar
      [opt-viewer] Python 3 support in opt-viewer.py · d3a05713
      Brian Gesiak authored
      Summary:
      Minor changes that allow opt-stats.py to support both Python 2 and 3.
      In addition to the same dictionary iterator changes that were necessary
      in https://reviews.llvm.org/D34564, this diff also:
      
      * Explcitly converts strings to bytes when reading from and writing to stdin
        and stdout.
      * No longer uses dictionaries as a sort key for optimization remarks.
        Dictionary sort order in Python 2 is pretty esoteric anyway, so it's
        not clear that the additional sorting had a benefit for end users
        (for details, https://stackoverflow.com/a/3484456/679254 is a good
        resource on Python 2 dictionary sort order).
      
      Reviewers: anemet, davidxl
      
      Reviewed By: anemet
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34647
      
      llvm-svn: 306720
      d3a05713
    • Yan Wang's avatar
      [clang-tidy] Add docs to toctree · 7272f06a
      Yan Wang authored
      Summary: Add .rst files to toctree. Fix buildbot error.
      
      Reviewers: chh
      
      Reviewed By: chh
      
      Subscribers: srhines, JDevlieghere, xazax.hun
      
      Differential Revision: https://reviews.llvm.org/D34825
      
      llvm-svn: 306719
      7272f06a
    • Sam Clegg's avatar
      llvm-nm: Add support for symbol demangling (-C/--demangle) · 531da008
      Sam Clegg authored
      Differential Revision: https://reviews.llvm.org/D34668
      
      llvm-svn: 306718
      531da008
    • Xin Tong's avatar
      [OrderedInst] Add const to constant parameter. NFCI · 66f6d69c
      Xin Tong authored
      llvm-svn: 306717
      66f6d69c
    • Hiroshi Inoue's avatar
      fix trivial typo, NFC · ff8453db
      Hiroshi Inoue authored
      llvm-svn: 306716
      ff8453db
    • Stephan Bergmann's avatar
      Fixed -Wexceptions derived-to-base false positives · 743de460
      Stephan Bergmann authored
      ...as introduced with recent <https://reviews.llvm.org/D33333> "Emit warning
      when throw exception in destruct or dealloc functions which has a (possible
      implicit) noexcept specifier".  (The equivalent of the goodReference case hit
      when building LibreOffice.)
      
      (These warnings are apparently only emitted when no errors have yet been
      encountered, so it didn't work to add the test code to the end of the existing
      clang/test/SemaCXX/exceptions.cpp.)
      
      llvm-svn: 306715
      743de460
    • Jakub Kuderski's avatar
      [Dominators] Rearrange access specifiers in DominatorTreeBase · c4bbce72
      Jakub Kuderski authored
      Summary:
      This patch makes DominatorTreeBase more readable by putting most important members on top of the class.
      
      Before, the class looked like that: private -> protected (including data members) -> public -> protected.
      The patch changes it to: protected (data members only) -> public -> protected -> public.
      
      Reviewers: dberlin, sanjoy, chandlerc
      
      Reviewed By: dberlin
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34527
      
      llvm-svn: 306714
      c4bbce72
    • Jakub Kuderski's avatar
      [Dominators] Remove DominatorBase class · 35fca341
      Jakub Kuderski authored
      Summary:
      DominatorBase class was only used by DominatorTreeBase. It didn't provide any useful abstractions, nor simplified anything, so I see no point keeping it.
      
      This commit removes the DominatorBase class and moves its content into DominatorTreeBase.
      
      This is the first patch in a series that tries to make all DomTrees have a single virtual root, which will allow to further simplify code (especially when it comes to incremental updates).
      
      Reviewers: dberlin, sanjoy, chandlerc
      
      Reviewed By: dberlin
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34493
      
      llvm-svn: 306713
      35fca341
    • Xin Tong's avatar
      Remove useless header. NFC · 02008c30
      Xin Tong authored
      llvm-svn: 306712
      02008c30
    • Jakub Kuderski's avatar
      [Dominators] Add parent and sibling property verification (non-hacky) · f9223365
      Jakub Kuderski authored
      Summary:
      This patch adds an additional level of verification - it checks parent and sibling properties of a tree. By definition, every tree with these two properties is a dominator tree.
      
      It is possible to run those check by running llvm with `-verify-dom-info=1`.
      
      Bootstrapping clang and building the llvm test suite with this option enabled doesn't yield any errors.
      
      Reviewers: dberlin, sanjoy, chandlerc
      
      Reviewed By: dberlin
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34482
      
      llvm-svn: 306711
      f9223365
    • Vedant Kumar's avatar
      [profile] Move __llvm_profile_filename into a separate object · ff3227e7
      Vedant Kumar authored
      Users can specify the path a raw profile is written to by passing
      -fprofile-instr-generate=<path>, but this functionality broke on Darwin
      after __llvm_profile_filename was made weak [1], resulting in profiles
      being written to "default.profraw" even when <path> is specified.
      
      The situation is that instrumented programs provide a weak definition of
      __llvm_profile_filename, which conflicts with a weak redefinition
      provided by the profiling runtime.
      
      The linker appears to pick the 'winning' definition arbitrarily: on
      Darwin, it usually prefers the larger definition, which is probably why
      the instrprof-override-filename.c test has been passing.
      
      The fix is to move the runtime's definition into a separate object file
      within the archive. This means that the linker won't "see" the runtime's
      definition unless the user program has not provided one. I couldn't
      think of a great way to test this other than to mimic the Darwin
      failure: use -fprofile-instr-generate=<some-small-path>.
      
      Testing: check-{clang,profile}, modified instrprof-override-filename.c.
      
      [1] [Profile] deprecate __llvm_profile_override_default_filename
      https://reviews.llvm.org/D22613
      https://reviews.llvm.org/D22614
      
      Differential Revision: https://reviews.llvm.org/D34797
      
      llvm-svn: 306710
      ff3227e7
    • Yan Wang's avatar
      [clang-tidy][Part3] Add a new module Android and three new checks. · 24340252
      Yan Wang authored
      Summary: -- fopen() should include "e" in their mode string. [android-fopen-mode]
      
      Reviewers: chh, alexfh, aaron.ballman, hokein
      
      Reviewed By: hokein
      
      Subscribers: JDevlieghere, srhines, mgorny, xazax.hun
      
      Tags: #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D33747
      
      llvm-svn: 306709
      24340252
    • Yan Wang's avatar
      [clang-tidy][Part2] Add a new module Android and three new checks · 0b974147
      Yan Wang authored
      Summary: -- creat() should be replaced by open(). [android-creat-usage] 
      
      Reviewers: chh, alexfh, aaron.ballman, hokein
      
      Reviewed By: hokein
      
      Subscribers: JDevlieghere, srhines, mgorny, xazax.hun
      
      Tags: #clang-tools-extra
      
      Differential Revision: https://reviews.llvm.org/D33745
      
      llvm-svn: 306708
      0b974147
    • Reid Kleckner's avatar
      Export the nothrow overload of operator new · 4f98ab36
      Reid Kleckner authored
      This missing export was causing allocator_returns_null.cc to fail on
      Windows with a dynamic ASan runtime.
      
      llvm-svn: 306707
      4f98ab36
    • Reid Kleckner's avatar
      Fix WinASan after moving wcslen interceptor to sanitizer_common · 4acf36be
      Reid Kleckner authored
      Do this by removing SANITIZER_INTERCEPT_WCSLEN and intercept wcslen
      everywhere. Before this change, we were already intercepting wcslen on
      Windows, but the interceptor was in asan, not sanitizer_common. After
      this change, we stopped intercepting wcslen on Windows, which broke
      asan_dll_thunk.c, which attempts to thunk to __asan_wcslen in the ASan
      runtime.
      
      llvm-svn: 306706
      4acf36be
    • Ilya Biryukov's avatar
      [clangd] Check failure of Lexer::getRawToken in GoToDeclaration. · 4203d2ad
      Ilya Biryukov authored
      There was an access to unitialized memory because it wasn't checked.
      
      llvm-svn: 306705
      4203d2ad
    • Leo Li's avatar
      [ConstantHoisting] Avoid hoisting constants in GEPs that index into a struct type. · 20fbad93
      Leo Li authored
      Summary:
      Indices for GEPs that index into a struct type should always be
      constants. This added more checks in `collectConstantCandidates:` which make
      sure constants for GEP pointer type are not hoisted.
      
      This fixed Bug https://bugs.llvm.org/show_bug.cgi?id=33538
      
      Reviewers: ributzka, rnk
      
      Reviewed By: ributzka
      
      Subscribers: efriedma, llvm-commits, srhines, javed.absar, pirama
      
      Differential Revision: https://reviews.llvm.org/D34576
      
      llvm-svn: 306704
      20fbad93
    • Daniel Berlin's avatar
      PredicateInfo: Use OrderedInstructions instead of our homemade · b7df17ec
      Daniel Berlin authored
      version.
      
      llvm-svn: 306703
      b7df17ec
    • Daniel Berlin's avatar
      NewGVN: Remove useless test in addPhiOfOps. · b779db7e
      Daniel Berlin authored
      llvm-svn: 306702
      b779db7e
    • Daniel Berlin's avatar
      Remove unneeded else from OrderedInstructions::dominates. · 7c757aee
      Daniel Berlin authored
      llvm-svn: 306701
      7c757aee
    • Paul Robinson's avatar
      Tweak to match change in LLVM API, in r306699 · c60318af
      Paul Robinson authored
      llvm-svn: 306700
      c60318af
    • Paul Robinson's avatar
      [DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor. · 17536b93
      Paul Robinson authored
      Requires callers to directly associate relocations with a DataExtractor
      used to read data from a DWARF section, which helps a callee not make
      assumptions about which section it is reading.
      This is the next step in reducing DWARFFormValue's dependence on DWARFUnit.
      
      Differential Revision: https://reviews.llvm.org/D34704
      
      llvm-svn: 306699
      17536b93
    • Kostya Kortchinsky's avatar
      [scudo] Change aligned alloc functions to be more compliant & perf changes · 0ce49990
      Kostya Kortchinsky authored
      Summary:
      We were not following the `man` documented behaviors for invalid arguments to
      `memalign` and associated functions. Using `CHECK` for those was a bit extreme,
      so we relax the behavior to return null pointers as expected when this happens.
      Adapt the associated test.
      
      I am using this change also to change a few more minor performance improvements:
      - mark as `UNLIKELY` a bunch of unlikely conditions;
      - the current `CHECK` in `__sanitizer::RoundUpTo` is redundant for us in *all*
        calls. So I am introducing our own version without said `CHECK`.
      - change our combined allocator `GetActuallyAllocatedSize`. We already know if
        the pointer is from the Primary or Secondary, so the `PointerIsMine` check is
        redundant as well, and costly for the 32-bit Primary. So we get the size by
        directly using the available Primary functions.
      
      Finally, change a `int` to `uptr` to avoid a warning/error when compiling on
      Android.
      
      Reviewers: alekseyshl
      
      Reviewed By: alekseyshl
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34782
      
      llvm-svn: 306698
      0ce49990
    • Alexey Bataev's avatar
      [OPENMP][DEBUG] Generate second function with correct arg types. · 1fdfdf71
      Alexey Bataev authored
      Currently, if the some of the parameters are captured by value, this
      argument is converted to uintptr_t type and thus we loosing the debug
      info about real type of the argument (captured variable):
      ```
      void @.outlined_function.(uintptr %par);
      
      ...
      %a = alloca i32
      %a.casted = alloca uintptr
      %cast = bitcast uintptr* %a.casted to i32*
      %a.val = load i32, i32 *%a
      store i32 %a.val, i32 *%cast
      %a.casted.val = load uintptr, uintptr* %a.casted
      call void @.outlined_function.(uintptr %a.casted.val)
      ...
      ```
      
      To resolve this problem, in debug mode a speciall external wrapper
      function is generated, that calls the outlined function with the correct
      parameters types:
      ```
      void @.wrapper.(uintptr %par) {
        %a = alloca i32
        %cast = bitcast i32* %a to uintptr*
        store uintptr %par, uintptr *%cast
        %a.val = load i32, i32* %a
        call void @.outlined_function.(i32 %a)
        ret void
      }
      void @.outlined_function.(i32 %par);
      
      ...
      %a = alloca i32
      %a.casted = alloca uintptr
      %cast = bitcast uintptr* %a.casted to i32*
      %a.val = load i32, i32 *%a
      store i32 %a.val, i32 *%cast
      %a.casted.val = load uintptr, uintptr* %a.casted
      call void @.wrapper.(uintptr %a.casted.val)
      ...
      ```
      
      llvm-svn: 306697
      1fdfdf71
    • NAKAMURA Takumi's avatar
      Test commit · b49ca64b
      NAKAMURA Takumi authored
      llvm-svn: 306696
      b49ca64b
    • Alexandre Isoard's avatar
      ScalarEvolution: Add URem support · aa29afc7
      Alexandre Isoard authored
      In LLVM IR the following code:
      
          %r = urem <ty> %t, %b
      
      is equivalent to:
      
          %q = udiv <ty> %t, %b
          %s = mul <ty> nuw %q, %b
          %r = sub <ty> nuw %t, %q ; (t / b) * b + (t % b) = t
      
      As UDiv, Mul and Sub are already supported by SCEV, URem can be
      implemented with minimal effort this way.
      
      Note: While SRem and SDiv are also related this way, SCEV does not
      provides SDiv yet.
      
      llvm-svn: 306695
      aa29afc7
    • Brian Gesiak's avatar
      [opt-viewer] opt-viewer.py takes -o argument · 39b88f01
      Brian Gesiak authored
      Summary:
      Change how the output directory is specified when invoking
      opt-viewer.py, from `opt-viewer.py yaml_file_one yaml_file_two output_dir` to
      `opt-viewer.py -o output_dir yaml_file_one yaml_file_two`.
      
      This makes it easier to pipe the results of another command into
      opt-viewer.py. For example:
      
      ```
      find . -name "*.yaml" -print | xargs /path/to/opt-viewer.py -o html
      ```
      
      Reviewers: anemet, davidxl
      
      Reviewed By: anemet
      
      Subscribers: fhahn, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34711
      
      llvm-svn: 306694
      39b88f01
    • Pavel Labath's avatar
      Speculative fix for windows build broken by r306668 · ef9fc29d
      Pavel Labath authored
      llvm-svn: 306693
      ef9fc29d
    • Vassil Vassilev's avatar
      Initialize variable and silence potentially uninitialized warning. · 809328c1
      Vassil Vassilev authored
      Patch by Liza Sakellari!
      
      llvm-svn: 306692
      809328c1
  2. Jun 29, 2017
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generation stages · 3addb7d8
      Gheorghe-Teodor Bercea authored
      Summary: The preprocessing and code generation and optimization stages of the compiler are also passed the "-fopenmp-is-device" flag. This is used to trigger machine specific preprocessing and code generation when performing device offloading to an NVIDIA GPU via OpenMP directives.
      
      Reviewers: arpith-jacob, caomhin, carlo.bertolli, Hahnfeld, hfinkel, tstellar
      
      Reviewed By: Hahnfeld
      
      Subscribers: Hahnfeld, rengolin
      
      Differential Revision: https://reviews.llvm.org/D29645
      
      llvm-svn: 306691
      3addb7d8
    • Krzysztof Parzyszek's avatar
      [Hexagon] Keep all phi nodes when building DFG in addr-mode-opt · 00894194
      Krzysztof Parzyszek authored
      The dead phis are needed for finding correct would-be reaching defs
      in register propagation.
      
      llvm-svn: 306690
      00894194
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Add support for auxiliary triple specification · 59d7b77b
      Gheorghe-Teodor Bercea authored
      Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa.
      
      Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar
      
      Reviewed By: Hahnfeld
      
      Subscribers: rengolin, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D29339
      
      llvm-svn: 306689
      59d7b77b
    • Nirav Dave's avatar
      [DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI. · 168c5a6a
      Nirav Dave authored
      Relanding after restricting equalBaseIndex to not erroneuosly consider
      a FrameIndices stemming from alloca from being comparable as its
      offset is set post-selectionDAG.
      
      Pull FrameIndex comparision reasoning from DAGCombiner::isAlias to
      general BaseIndexOffset.
      
      llvm-svn: 306688
      168c5a6a
    • Eugene Leviant's avatar
      [llvm-objdump] Handle invalid instruction gracefully on ARM · 6269d39f
      Eugene Leviant authored
      Differential revision: https://reviews.llvm.org/D34813
      
      llvm-svn: 306687
      6269d39f
    • Pavel Labath's avatar
      Fix Mac build for the Timer move · 48090724
      Pavel Labath authored
      llvm-svn: 306686
      48090724
    • Yonghong Song's avatar
      bpf: remove unnecessary truncate operation · 5fbe01b1
      Yonghong Song authored
      
      
      For networking-type bpf program, it often needs to access
      packet data. A context data structure is provided to the bpf
      programs with two fields:
              u32 data;
              u32 data_end;
      User can access these two fields with ctx->data and ctx->data_end.
      During program verification process, the kernel verifier modifies
      the bpf program with loading of actual pointer value from kernel
      data structure.
          r = ctx->data      ===> r = actual data start ptr
          r = ctx->data_end  ===> r = actual data end ptr
      
      A typical program accessing ctx->data like
          char *data_ptr = (char *)(long)ctx->data
      will result in a 32-bit load followed by a zero extension.
      Such an operation is combined into a single LDW in DAG combiner
      as bpf LDW does zero extension automatically.
      
      In cases like the below (which can be a result of global value numbering
      and partial redundancy elimination before insn selection):
      B1:
         u32 a = load-32-bit &ctx->data
         u64 pa = zext a
         ...
      B2:
         u32 b = load-32-bit &ctx->data
         u64 pb = zext b
         ...
      B3:
         u32 m = PHI(a, b)
         u64 pm = zext m
      
      In B3, "pm = zext m" cannot be removed, which although is legal
      from compiler perspective, will generate incorrect code after
      kernel verification.
      
      This patch recognizes this pattern and traces through PHI node
      to see whether the operand of "zext m" is defined with LDWs or not.
      If it is, the "zext m" itself can be removed.
      
      The patch also recognizes the pattern where the load and use of
      the load value not in the same basic block, where truncate operation
      may be removed as well.
      
      The patch handles 1-byte, 2-byte and 4-byte truncation.
      
      Two test cases are added to verify the transformation happens properly
      for the above code pattern.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      llvm-svn: 306685
      5fbe01b1