1. Apr 26, 2018
    • Reid Kleckner's avatar
      [codeview] Ignore .cv_loc directives at the end of a function · 2c6430fe
      Reid Kleckner authored
      If no data or instructions are emitted after a location directive, we
      should clear the cv_loc when we change sections, or it will be emitted
      at the beginning of the next section. This violates our invariant that
      all .cv_loc directives belong to the same section. Add clearer
      assertions for this.
      
      llvm-svn: 330884
      2c6430fe
    • Bob Haarman's avatar
      [COFF] more informative "broken object file" diagnostics · 947647d0
      Bob Haarman authored
      Summary:
      When a symbol refers to a special section or a section that doesn't
      exist, lld would fatal with "broken object file". This change gives a
      different message for each scenario, and includes the name of the
      file, name of the symbol, and the section being referred to.
      
      Reviewers: pcc, ruiu
      
      Reviewed By: ruiu
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46090
      
      llvm-svn: 330883
      947647d0
    • Artem Dergachev's avatar
      [analyzer] Fix a crash on lifetime extension through aggregate initialization. · 310bca01
      Artem Dergachev authored
      If 'A' is a C++ aggregate with a reference field of type 'C', in code like
        A a = { C() };
      C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
      crashing. Additionally, destructors aren't added in the CFG for this case,
      so for now we shouldn't be inlining the constructor for C().
      
      Differential Revision: https://reviews.llvm.org/D46037
      
      llvm-svn: 330882
      310bca01
    • Richard Smith's avatar
      Fix crash on qualified template name instantiation if the template name has no · 0bf96f93
      Richard Smith authored
      template argument list.
      
      llvm-svn: 330881
      0bf96f93
    • Ana Pazos's avatar
      [RISCV] More validations on the input value of -march= · c8550545
      Ana Pazos authored
      Supporting additional rules for parsing ISA string.
      
      - RISC-V ISA strings must be lowercase.
      E.g.: rv32IMC is not supported, rv32imc is correct.
      
      - Multi-letter extensions are to be separated by a single
      underscore '_'. The extension prefix counts as a letter.
      This means extensions that start with 's', 'sx' and 'sx'
      are all multi-letter.
      E.g.:
      xasb is a single non-standard extension named 'xasb'
      xa_sb are two extensions, the non-standard user level extension
      'xa', and the supervisor level extension 'sb'.
      
      - Standard user-level extensions are specified following
      a canonical order, according to Table 22.1 in
      RISC-V User-Level ISA V2.2.
      
      - Non-standard user-level 'x' extensions,
      standard supervisor-level 's' extensions and
      non-standard supervisor-level 'sx' extensions
      are also specified following a canonical order according
      to Table 22.1 in RISC-V User-Level ISA V2.2:
      'x' extensions, follwed by 's' extensions and then 'sx' extensions.
      
      - Extensions might have a version number.
      Underscores may be used to separate ISA subset components to
      improve readability and to provide disambiguation.
      E.g.: rv32i2_m3_a1_f2_d2
      
      - Version numbers are divided into major and minor numbers,
      separated by a 'p'. If the minor version is 0, then 'p0' can
      be omitted.
      
      - Additional checks for dependent extensions and invalid
      extensions combinations.
      E.g.:
      'e' requires rv32
      'e' can't be combined with 'f' nor 'd'
      'q' requires rv64
      
      - TODO items have also been marked with comments in the code.
      
      Reviewers: asb, kito-cheng
      
      Reviewed By: asb
      
      Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D45284
      
      llvm-svn: 330880
      c8550545
    • Rui Ueyama's avatar
      Remove unused features from StringRefZ and move it to Symbols.h. · 5fcebff4
      Rui Ueyama authored
      Differential Revision: https://reviews.llvm.org/D46087
      
      llvm-svn: 330879
      5fcebff4
    • Alex Lorenz's avatar
      [driver][darwin] Do not infer -simulator environment for OS version env vars · 76661e0f
      Alex Lorenz authored
      with non-simulator SDKs
      
      rdar://37955008
      
      llvm-svn: 330878
      76661e0f
    • Frederic Riss's avatar
      [debugserver] Return 'ios' instead of 'iphoneos' for the ostype. · 05e8bc85
      Frederic Riss authored
      When I merged the 2 codepaths that return an OS type, I hade
      checked that the places accepting 'iphoneos' would also accept
      'ios', but then I got it backwards and return 'iphoneos'.
      
      We use this value to build triples, and there 'iphoneos' is
      invalid.
      
      This also makes the test slightly simpler.
      
      llvm-svn: 330877
      05e8bc85
    • Artem Dergachev's avatar
      [analyzer] Enable analysis of WebKit "unified sources". · 516837f2
      Artem Dergachev authored
      Normally the analyzer begins path-sensitive analysis from functions within
      the main file, even though the path is allowed to go through any functions
      within the translation unit.
      
      When a recent version of WebKit is compiled, the "unified sources" technique
      is used, that assumes #including multiple code files into a single main file.
      Such file would have no functions defined in it, so the analyzer wouldn't be
      able to find any entry points for path-sensitive analysis.
      
      This patch pattern-matches unified file names that are similar to those
      used by WebKit and allows the analyzer to find entry points in the included
      code files. A more aggressive/generic approach is being planned as well.
      
      Differential Revision: https://reviews.llvm.org/D45839
      
      llvm-svn: 330876
      516837f2
    • Vedant Kumar's avatar
      [ADT] Make filter_iterator support bidirectional iteration · 75fda2e0
      Vedant Kumar authored
      This makes it possible to reverse a filtered range. For example, here's
      a way to visit memory accesses in a BasicBlock in reverse order:
      
          auto MemInsts = reverse(make_filter_range(BB, [](Instruction &I) {
            return isa<StoreInst>(&I) || isa<LoadInst>(&I);
          }));
      
          for (auto &MI : MemInsts)
            ...
      
      To implement this functionality, I factored out forward iteration
      functionality into filter_iterator_base, and added a specialization of
      filter_iterator_impl which supports bidirectional iteration. Thanks to
      Tim Shen, Zachary Turner, and others for suggesting this design and
      providing feedback! This version of the patch supersedes the original
      (https://reviews.llvm.org/D45792).
      
      This was motivated by a problem we encountered in D45657: we'd like to
      visit the non-debug-info instructions in a BasicBlock in reverse order.
      
      Testing: check-llvm, check-clang
      
      Differential Revision: https://reviews.llvm.org/D45853
      
      llvm-svn: 330875
      75fda2e0
    • Rafael Espindola's avatar
      Pack symbols a bit more. · 1eeb2629
      Rafael Espindola authored
      Before this patch:
      
      Symbol 56
      Defined 80
      Undefined 56
      SharedSymbol 88
      LazyArchive 72
      LazyObject 56
      
      With this patch
      
      Symbol 48
      Defined 72
      Undefined 48
      SharedSymbol 80
      LazyArchive 64
      LazyObject 48
      
      The result is that peak allocation when linking chromium (according to
      heaptrack) goes from 578 to 568 MB.
      
      llvm-svn: 330874
      1eeb2629
    • Dan Albert's avatar
      [Driver] Reland "Android triples are not aliases for other triples." · ed8b8fdc
      Dan Albert authored
      Fixed directory separators in tests to be compatible with both
      Windows and !Windows.
      
      This reverts commit aa423850afa4c16a53c4c492fe254dcad3d5a53e.
      
      llvm-svn: 330873
      ed8b8fdc
    • Martin Storsjo's avatar
      aadc1c8b
    • Martin Storsjo's avatar
      [Driver] Fix implicit config files from prefixed symlinks · 1fab23da
      Martin Storsjo authored
      If -no-canonical-prefixes isn't used, the clang executable name used
      is the one of the actual executable, not the name of the symlink that
      the user invoked.
      
      In these cases, the target prefix was overridden based on the clang
      executable name. (On the other hand the implicit -target option
      that such a symlink adds, is added as an actual command line parameter
      in tools/driver/driver.cop, before resolving the symlink and finding
      the actual clang executable.
      
      Use the original ClangNameParts (set from argv[0] in
      tools/driver/driver.cpp) if it seems to be initialized propery.
      
      All existing tests of this feature used -no-canonical-prefixes
      (possibly because it also makes the driver look in the directory
      of the symlink instead of the directory of the executable); add
      another one that uses --config-user-dir= to specify the directory
      instead. (For actual users of such symlinks, outisde of the test
      suite, the directory is probably the same for both.)
      
      This makes this feature work more like what the documentation
      describes.
      
      Differential Revision: https://reviews.llvm.org/D45964
      
      llvm-svn: 330871
      1fab23da
    • Simon Pilgrim's avatar
      [CostModel][X86] Remove hard coded SDIV/UDIV vector costs · 2faf606f
      Simon Pilgrim authored
      Algorithmically compute the 'x20' SDIV/UDIV vector costs - this is necessary for PR36550 when DIV costs will be driven from the scheduler models.
      
      llvm-svn: 330870
      2faf606f
    • Rafael Espindola's avatar
      Also demote lazy symbols. · 047f8576
      Rafael Espindola authored
      This is not a big simplification right now, but the special cases for
      lazy symbols have been a common source of bugs in the past.
      
      llvm-svn: 330869
      047f8576
    • Hans Wennborg's avatar
      [COFF] Don't set the tsaware bit on DLLs · 03ca8f4f
      Hans Wennborg authored
      It doesn't apply to DLLs, and link.exe doesn't set it.
      
      Differential Revision: https://reviews.llvm.org/D46077
      
      llvm-svn: 330868
      03ca8f4f
    • Reid Kleckner's avatar
      Fix PluginsTests failure on Windows buildbots by enabling it everywhere · e765d633
      Reid Kleckner authored
      lit is picking up a stale executable in the unittests tree, which is
      failing on Windows.
      
      To simplify the CMake and avoid problems like this in the future, now we
      always compile the test, but the test exits successfully when plugins
      are not enabled.
      
      llvm-svn: 330867
      e765d633
    • Tom Stellard's avatar
      AMDGPU/R600: Move int_r600_store_stream_output to the public intrinsic file · dce46fa1
      Tom Stellard authored
      Summary:
      The TableGen'd GlobalISel instruction selector assumes all intrinsics are in
      the public Intrinsic:: namespace.
      
      Reviewers: jvesely, nhaehnle
      
      Reviewed By: jvesely, nhaehnle
      
      Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D45989
      
      llvm-svn: 330866
      dce46fa1
    • Michael Kruse's avatar
      [CodeGen] Fix comment. NFC. · 8aedbd9d
      Michael Kruse authored
      llvm-svn: 330865
      8aedbd9d
    • Michael Kruse's avatar
      [CodeGen] Print executed statement instances at runtime. · e819fffe
      Michael Kruse authored
      Add the options -polly-codegen-trace-stmts and
      -polly-codegen-trace-scalars. When enabled, adds a call to the
      beginning of every generated statement that prints the executed
      statement instance. With -polly-codegen-trace-scalars, it also prints
      the value of all scalars that are used in the statement, and PHIs
      defined in the beginning of the statement.
      
      Differential Revision: https://reviews.llvm.org/D45743
      
      llvm-svn: 330864
      e819fffe
    • Petar Jovanovic's avatar
      Add s390x to XFAIL for illegal_read/write_test.cc · 15206027
      Petar Jovanovic authored
      Follow up to r330840 and r330849.
      It seems that s390 is also not distinguishing illegal WRITE and READ memory
      access.
      Add s390x to XFAIL for the tests.
      
      llvm-svn: 330863
      15206027
    • Mark Searles's avatar
      [AMDGPU] Waitcnt pass: add debug options · ec58183e
      Mark Searles authored
      - Add "amdgpu-waitcnt-forcezero" to force all waitcnt instrs to be emitted as s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
      
      - Add debug counters to control force emit of s_waitcnt instrs; debug counters:
      si-insert-waitcnts-forceexp: force emit s_waitcnt expcnt(0) instrs
      si-insert-waitcnts-forcevm: force emit s_waitcnt lgkmcnt(0) instrs
      si-insert-waitcnts-forcelgkm: force emit s_waitcnt vmcnt(0) instrs
      
      - Add some debug statements
      
      Note that a variant of this patch was previously committed/reverted.
      
      Differential Revision: https://reviews.llvm.org/D45888
      
      llvm-svn: 330862
      ec58183e
    • Eli Friedman's avatar
      [TargetInfo] Sort target features before passing them to the backend · e54d0ff4
      Eli Friedman authored
      Passing the features in random order will lead to unpredictable results
      when some of the features are related (like the architecture-version
      features on ARM).
      
      It might be possible to fix this particular case in the ARM target code,
      to avoid adding overlapping target features. But we should probably be
      sorting in any case: the behavior shouldn't depend on StringMap's
      hashing algorithm.
      
      Differential Revision: https://reviews.llvm.org/D46030
      
      llvm-svn: 330861
      e54d0ff4
    • David Bolvansky's avatar
      [SimplifyLibcalls] Atoi, strtol replacements · cb8ca5f3
      David Bolvansky authored
      Reviewers: spatel, lebedev.ri, xbolva00, efriedma
      
      Reviewed By: xbolva00, efriedma
      
      Subscribers: efriedma, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D45418
      
      llvm-svn: 330860
      cb8ca5f3
    • Francis Visoiu Mistrih's avatar
      [MIR] Add support for debug metadata for fixed stack objects · 57fcd345
      Francis Visoiu Mistrih authored
      Debug var, expr and loc were only supported for non-fixed stack objects.
      
      This patch adds the following fields to the "fixedStack:" entries, and
      renames the ones from "stack:" to:
      
      * debug-info-variable
      * debug-info-expression
      * debug-info-location
      
      Differential Revision: https://reviews.llvm.org/D46032
      
      llvm-svn: 330859
      57fcd345
    • Michael Kruse's avatar
      [ScopDetect] Reject loop with multiple exit blocks. · beffdb9d
      Michael Kruse authored
      The current statement domain derivation algorithm does not (always)
      consider that different exit blocks of a loop can have different
      conditions to be reached.
      
      From the code
      
            for (int i = n; ; i-=2) {
              if (i <= 0) goto even;
              if (i <= 1) goto odd;
              A[i] = i;
            }
          even:
            A[0] = 42;
            return;
          odd:
            A[1] = 21;
            return;
      
      Polly currently derives the following domains:
      
              Stmt_even_critedge
                  Domain :=
                      [n] -> { Stmt_even_critedge[] };
              Stmt_odd
                  Domain :=
                      [n] -> { Stmt_odd[] : (1 + n) mod 2 = 0 and n > 0 };
      
      while the domain for the odd case is correct, Stmt_even is assumed to be
      executed unconditionally, which is obviously wrong. While projecting out
      the loop dimension in `adjustDomainDimensions`, it does not consider
      that there are other exit condition that have matched before.
      
      I don't know a how to fix this without changing a lot of code. Therefore
      This patch rejects loops with multiple exist blocks to fix the
      miscompile of test-suite's uuencode.
      
      The odd condition is transformed by LLVM to
      
          %cmp1 = icmp eq i64 %indvars.iv, 1
      
      such that the project_out in adjustDomainDimensions() indeed only
      matches for odd n (using this condition only, we'd have an infinite loop
      otherwise).
      
      The even condition manifests as
      
          %cmp = icmp slt i64 %indvars.iv, 3
      
      Because buildDomainsWithBranchConstraints() does not consider other exit
      conditions, it has to assume that the induction variable will eventually
      be lower than 3 and taking this exit.
      
      IMHO we need to reuse the algorithm that determines the number of
      iterations (addLoopBoundsToHeaderDomain) to determine which exit
      condition applies first. It has to happen in
      buildDomainsWithBranchConstraints() because the result will need to
      propagate to successor BBs. Currently addLoopBoundsToHeaderDomain() just
      look for union of all backedge conditions (which means leaving not the
      loop here). The patch in llvm.org/PR35465 changes it to look for exit
      conditions instead. This is required because there might be other exit
      conditions that do not alternatively go back to the loop header.
      
      Differential Revision: https://reviews.llvm.org/D45649
      
      llvm-svn: 330858
      beffdb9d
    • Kostya Kortchinsky's avatar
      [scudo] Adding an interface function to print allocator stats · d8803d3d
      Kostya Kortchinsky authored
      Summary:
      This adds `__scudo_print_stats` as an interface function to display the Primary
      and Secondary allocator statistics for Scudo.
      
      Reviewers: alekseyshl, flowerhack
      
      Reviewed By: alekseyshl
      
      Subscribers: delcypher, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D46016
      
      llvm-svn: 330857
      d8803d3d
    • Nico Weber's avatar
      IWYU llvm-config.h for LLVM_VERSION_STRING · a48924c7
      Nico Weber authored
      llvm-svn: 330856
      a48924c7
    • Petr Hosek's avatar
      [CMake] Enable libc++ for Fuchsia toolchain on Darwin · 17fdef66
      Petr Hosek authored
      This is necessary in order to get a working C++ compiler on Darwin
      since Clang expects libc++ headers to be part of the toolchain.
      
      Differential Revision: https://reviews.llvm.org/D46075
      
      llvm-svn: 330855
      17fdef66
    • Sam Clegg's avatar
      [WebAssebmly] Add Module name to WasmSymbol · 9067b46e
      Sam Clegg authored
      Imports in a wasm module can have custom module name.  This change
      adds the module name to the WasmSymbol structure so that the linker
      can preserve this module name.
      
      This is needed to fix: https://bugs.llvm.org/show_bug.cgi?id=37168
      
      Differential Revision: https://reviews.llvm.org/D45797
      
      llvm-svn: 330854
      9067b46e
    • Nico Weber's avatar
      Rename sancov.cc to sancov.cpp · 4264a389
      Nico Weber authored
      LLVM uses cpp as its C++ file ending.
      https://reviews.llvm.org/D46068
      
      llvm-svn: 330853
      4264a389
    • Simon Pilgrim's avatar
      [CostModel][X86] Add div/rem tests for non-uniform constant divisors · 0ae4bba9
      Simon Pilgrim authored
      llvm-svn: 330852
      0ae4bba9
    • Jan Vesely's avatar
      1647e503
    • Craig Topper's avatar
      [X86] Form MUL_IMM for multiplies with 3/5/9 to encourage LEA formation over load folding. · 300e20d6
      Craig Topper authored
      Previously we only formed MUL_IMM when we split a constant. This blocked load folding on those cases. We should also form MUL_IMM for 3/5/9 to favor LEA over load folding.
      
      Differential Revision: https://reviews.llvm.org/D46040
      
      llvm-svn: 330850
      300e20d6
    • Petar Jovanovic's avatar
      Finetune supported arches for the tests added in r330840 · 3517ece2
      Petar Jovanovic authored
      r330840 introduced two tests that may not be supported on all architectures.
      powerpc64 seems to be one of those.
      
      llvm-svn: 330849
      3517ece2
    • Reid Kleckner's avatar
      Revert r330755 "[lit] Report line number for failed RUN command" · 1ca66688
      Reid Kleckner authored
      It is causing many tests to fail on Windows buildbots:
      http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10211
      
      llvm-svn: 330848
      1ca66688
    • Peter Szecsi's avatar
      [ASTImporter] FriendDecl importing improvements · b180eebe
      Peter Szecsi authored
      There are only a few cases of importing a frienddecl which is currently supported.
      This patch aims to improve the friend import process.
      Set FriendObjectKind in case of decls, insert friend into the friend chain
      correctly, checks structurally equivalent in a more advanced manner.
      Test cases added as well.  
      
      llvm-svn: 330847
      b180eebe
    • Alex Bradbury's avatar
      [RISCV] Allow call pseudoinstruction to be used to call a function name that... · cd8688a4
      Alex Bradbury authored
      [RISCV] Allow call pseudoinstruction to be used to call a function name that coincides with a register name
      
      Previously `call zero`, `call f0` etc would fail. This leads to compilation 
      failures if building programs that define functions with those names and using 
      -save-temps.
      
      llvm-svn: 330846
      cd8688a4
    • Nico Weber's avatar
      Don't list a source file twice. · 39d61944
      Nico Weber authored
      llvm-svn: 330845
      39d61944