1. Feb 25, 2017
    • Nirav Dave's avatar
      In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled. · beabf456
      Nirav Dave authored
          Recommiting after fixup of 32-bit aliasing sign offset bug in DAGCombiner.
      
          * Simplify Consecutive Merge Store Candidate Search
      
          Now that address aliasing is much less conservative, push through
          simplified store merging search and chain alias analysis which only
          checks for parallel stores through the chain subgraph. This is cleaner
          as the separation of non-interfering loads/stores from the
          store-merging logic.
      
          When merging stores search up the chain through a single load, and
          finds all possible stores by looking down from through a load and a
          TokenFactor to all stores visited.
      
          This improves the quality of the output SelectionDAG and the output
          Codegen (save perhaps for some ARM cases where we correctly constructs
          wider loads, but then promotes them to float operations which appear
          but requires more expensive constant generation).
      
          Some minor peephole optimizations to deal with improved SubDAG shapes (listed below)
      
          Additional Minor Changes:
      
            1. Finishes removing unused AliasLoad code
      
            2. Unifies the chain aggregation in the merged stores across code
               paths
      
            3. Re-add the Store node to the worklist after calling
               SimplifyDemandedBits.
      
            4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
               arbitrary, but seems sufficient to not cause regressions in
               tests.
      
            5. Remove Chain dependencies of Memory operations on CopyfromReg
               nodes as these are captured by data dependence
      
            6. Forward loads-store values through tokenfactors containing
                {CopyToReg,CopyFromReg} Values.
      
            7. Peephole to convert buildvector of extract_vector_elt to
               extract_subvector if possible (see
               CodeGen/AArch64/store-merge.ll)
      
            8. Store merging for the ARM target is restricted to 32-bit as
               some in some contexts invalid 64-bit operations are being
               generated. This can be removed once appropriate checks are
               added.
      
          This finishes the change Matt Arsenault started in r246307 and
          jyknight's original patch.
      
          Many tests required some changes as memory operations are now
          reorderable, improving load-store forwarding. One test in
          particular is worth noting:
      
            CodeGen/PowerPC/ppc64-align-long-double.ll - Improved load-store
            forwarding converts a load-store pair into a parallel store and
            a memory-realized bitcast of the same value. However, because we
            lose the sharing of the explicit and implicit store values we
            must create another local store. A similar transformation
            happens before SelectionDAG as well.
      
          Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
      
      llvm-svn: 296252
      beabf456
    • Piotr Padlewski's avatar
      [Doc] Modernize programmers manual · 48107729
      Piotr Padlewski authored
      Summary:
      Fixed bunch of for loops to range based for loop
      and bunch of rendundat types with auto.
      
      Reviewers: echristo, silvas, chandlerc
      
      Subscribers: mehdi_amini, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D30338
      
      llvm-svn: 296251
      48107729
    • Xin Tong's avatar
      Empty line. NFCI · b529c66e
      Xin Tong authored
      llvm-svn: 296250
      b529c66e
    • Daniel Jasper's avatar
      Add static_cast to silence -Wc++11-narrowing. · 6249d4d3
      Daniel Jasper authored
      llvm-svn: 296249
      6249d4d3
    • Vedant Kumar's avatar
      Weaken test/Profile/c-ternary.c · dcfe34e6
      Vedant Kumar authored
      There is a bot which doesn't use '%1' as the IR name of the first
      argument to a function:
      
      http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2050/steps/test-stage1-compiler/logs/stdio
      
      llvm-svn: 296248
      dcfe34e6
    • Vedant Kumar's avatar
      Suppress uninteresting warnings in test/CoverageMapping, NFC. · 3ec213e0
      Vedant Kumar authored
      llvm-svn: 296247
      3ec213e0
    • Vedant Kumar's avatar
      Fix -Wparentheses warning · 66c00cc4
      Vedant Kumar authored
      llvm-svn: 296246
      66c00cc4
    • Vedant Kumar's avatar
      Retry: [profiling] Fix profile counter increment when emitting selects (PR32019) · 502bbfaf
      Vedant Kumar authored
      2nd attempt: the first was in r296231, but it had a use after lifetime
      bug.
      
      Clang has logic to lower certain conditional expressions directly into llvm
      select instructions. However, it does not emit the correct profile counter
      increment as it does this: it emits an unconditional increment of the counter
      for the 'then branch', even if the value selected is from the 'else branch'
      (this is PR32019).
      
      That means, given the following snippet, we would report that "0" is selected
      twice, and that "1" is never selected:
      
        int f1(int x) {
          return x ? 0 : 1;
                     ^2  ^0
        }
      
        f1(0);
        f1(1);
      
      Fix the problem by using the instrprof_increment_step intrinsic to do the
      proper increment.
      
      llvm-svn: 296245
      502bbfaf
    • Zachary Turner's avatar
      [PDB] Disable some tests that are breaking bots. · 4284ce13
      Zachary Turner authored
      This has to do with big endian, but I can't fix it until
      Monday.  The code itself is fine, just the tests are wrong.
      Disabling 3 tests for now.
      
      llvm-svn: 296244
      4284ce13
    • Jason Molenda's avatar
      Three LoadLibCxxFormatters formatters were given a regex string to · 6b652bea
      Jason Molenda authored
      match but the 'is_regex' argument was not passed as true.  Not sure
      this is causing a bug, but noticed it while working on another bug.
      These formatters gained a regex in r274489 for NDK but didn't pick
      up the is_regex flag at the time.
      <rdar://problem/30646077> 
      
      llvm-svn: 296243
      6b652bea
    • Dominic Chen's avatar
      [analyzer] Refactor and simplify SimpleConstraintManager · 9bc02cee
      Dominic Chen authored
      Summary: SimpleConstraintManager is difficult to use, and makes assumptions about capabilities of the constraint manager. This patch refactors out those portions into a new RangedConstraintManager, and also fixes some issues with camel case, formatting, and confusing naming.
      
      Reviewers: zaks.anna, dcoughlin
      
      Subscribers: mgorny, xazax.hun, NoQ, rgov, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D26061
      
      llvm-svn: 296242
      9bc02cee
    • Jan Vesely's avatar
      AMDGPU: export s_sendmsg{halt} instrinsics · 9488560b
      Jan Vesely authored
      Differential Revision: https://reviews.llvm.org/D30366
      
      llvm-svn: 296241
      9488560b
    • Jan Vesely's avatar
      AMDGPU: export l1 cache invalidation intrinsics · c2550975
      Jan Vesely authored
      Differential Revision: https://reviews.llvm.org/D30360
      
      llvm-svn: 296240
      c2550975
    • Jan Vesely's avatar
      AMDGPU: export s_waitcnt builtin · d26dbb38
      Jan Vesely authored
      Differential Revision: https://reviews.llvm.org/D30359
      
      llvm-svn: 296239
      d26dbb38
    • Jason Molenda's avatar
      fad62c95
    • NAKAMURA Takumi's avatar
      Revert r296166, "clang-format: Don't leave behind temp files in -i mode on... · d274dc38
      NAKAMURA Takumi authored
      Revert r296166, "clang-format: Don't leave behind temp files in -i mode on Windows, PR26125", and r296171.
      
      (MemoryBuffer)Code.reset() was too early.
      
        ==26912== Invalid read of size 1
        ==26912==    at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, bool) (MemoryBuffer.cpp:47)
        ==26912==    by 0x438013: (anonymous namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) (MemoryBuffer.cpp:86)
        ==26912==    by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (MemoryBuffer.cpp:112)
        ==26912==    by 0x4E189D: clang::vfs::detail::(anonymous namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:443)
        ==26912==    by 0x4DF5BA: clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:94)
        ==26912==    by 0x4B72EC: clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) (FileManager.cpp:443)
        ==26912==    by 0x4C1F81: clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, clang::SourceManager const&, clang::SourceLocation, bool*) const (SourceManager.cpp:98)
        ==26912==    by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, bool*) const (SourceManager.cpp:689)
        ==26912==    by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) (Rewriter.cpp:230)
        ==26912==    by 0x407297: clang::format::format(llvm::StringRef) (ClangFormat.cpp:311)
        ==26912==    by 0x4078D7: main (ClangFormat.cpp:363)
      
      llvm-svn: 296237
      d274dc38
    • Rui Ueyama's avatar
      Add how long it takes to link chromium using ld.bfd. · db895d83
      Rui Ueyama authored
      llvm-svn: 296236
      db895d83
    • Rui Ueyama's avatar
      Fix rst document format error. · 7c9f00e6
      Rui Ueyama authored
      llvm-svn: 296235
      7c9f00e6
    • Vedant Kumar's avatar
      Revert "[profiling] Fix profile counter increment when emitting selects (PR32019)" · a45f315e
      Vedant Kumar authored
      This reverts commit r296231. It causes an assertion failure on 32-bit
      machines
      
      clang: /export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/lib/IR/Instructions.cpp:263: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
      llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5fbfa)
      llvm::sys::RunSignalHandlers() (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5dc7e)
      SignalHandler(int) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5dde2)
      __restore_rt (/lib64/libpthread.so.0+0x3f1d00efa0)
      __GI_raise /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
      __GI_abort /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/stdlib/abort.c:92:0
      __assert_fail_base /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/assert/assert.c:92:0
      (/lib64/libc.so.6+0x3f1c82e622)
      llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1804e3a)
      clang::CodeGen::CodeGenPGO::emitCounterIncrement(clang::CodeGen::CGBuilderTy&, clang::Stmt const*, llvm::Value*) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1ec7891)
      
      llvm-svn: 296234
      a45f315e
    • Jan Vesely's avatar
      math: Implement sinh function · 9f717296
      Jan Vesely authored
      mostly copied form amd_builtins
      
      llvm-svn: 296233
      9f717296
    • Rui Ueyama's avatar
      Factor out more code. NFC. · 28eada10
      Rui Ueyama authored
      llvm-svn: 296232
      28eada10
    • Vedant Kumar's avatar
      [profiling] Fix profile counter increment when emitting selects (PR32019) · c416e99d
      Vedant Kumar authored
      Clang has logic to lower certain conditional expressions directly into
      llvm select instructions. However, it does not emit the correct profile
      counter increment as it does this: it emits an unconditional increment
      of the counter for the 'then branch', even if the value selected is from
      the 'else branch' (this is PR32019).
      
      That means, given the following snippet, we would report that "0" is
      selected twice, and that "1" is never selected:
      
        int f1(int x) {
          return x ? 0 : 1;
                     ^2  ^0
        }
      
        f1(0);
        f1(1);
      
      Fix the problem by using the instrprof_increment_step intrinsic to do
      the proper increment.
      
      llvm-svn: 296231
      c416e99d
    • Rui Ueyama's avatar
      Remove a default value that is always overwritten. · 47926abf
      Rui Ueyama authored
      llvm-svn: 296230
      47926abf
    • Rui Ueyama's avatar
      Make function names consistent. · 10571cd3
      Rui Ueyama authored
      Now a function to parse -foo-bar is always named getFooBar.
      
      llvm-svn: 296229
      10571cd3
    • Jan Vesely's avatar
      AMDGPU/SI: export s_waitcnt builtin · 44e453b7
      Jan Vesely authored
      Differential Revision: https://reviews.llvm.org/D30358
      
      llvm-svn: 296228
      44e453b7
    • Rui Ueyama's avatar
      Do not handle -strip in a special way. NFC. · 524d44c6
      Rui Ueyama authored
      llvm-svn: 296227
      524d44c6
    • Rui Ueyama's avatar
      Factor out code to parse -hash-style. · dfa3ad13
      Rui Ueyama authored
      llvm-svn: 296226
      dfa3ad13
    • Rui Ueyama's avatar
      Rename OMagic -> Omagic for consistency. · a37ace8d
      Rui Ueyama authored
      llvm-svn: 296225
      a37ace8d
    • Rui Ueyama's avatar
      Factor out code to parse -L and -rpath. · 7edde294
      Rui Ueyama authored
      llvm-svn: 296224
      7edde294
    • Rui Ueyama's avatar
      Sort options. NFC. · a4a643c6
      Rui Ueyama authored
      llvm-svn: 296223
      a4a643c6
    • Junmo Park's avatar
      Minor code cleanup. NFC. · 061bec80
      Junmo Park authored
      llvm-svn: 296222
      061bec80
    • Richard Trieu's avatar
      [ODRHash] Move inherited visitor call to end of function. · ff60e0f8
      Richard Trieu authored
      llvm-svn: 296221
      ff60e0f8
    • Zachary Turner's avatar
      Re-enable BinaryStreamTest.StreamReaderObject. · 3e2b6925
      Zachary Turner authored
      I had an invalid pointer / size calculation that was causing
      a stack smash.  Should be fixed now.
      
      llvm-svn: 296220
      3e2b6925
    • Akira Hatanaka's avatar
      Remove redundant code. NFC. · f003cd33
      Akira Hatanaka authored
      llvm-svn: 296219
      f003cd33
    • Akira Hatanaka's avatar
      Clean up ObjCARCOpts.cpp. NFC. · 2b882050
      Akira Hatanaka authored
      I removed unused functions and variables and moved variables closer to
      their uses.
      
      llvm-svn: 296218
      2b882050
    • Zachary Turner's avatar
      Disable BinaryStreamTest.StreamReaderObject temporarily. · 42d45073
      Zachary Turner authored
      This is crashing on some bots, so I need some time to investigate.
      
      llvm-svn: 296217
      42d45073
    • Paul Robinson's avatar
      Revert r296209, still one more test to go. · 40327852
      Paul Robinson authored
      llvm-svn: 296216
      40327852
    • Zachary Turner's avatar
      [PDB] General improvements to Stream library. · af299ea5
      Zachary Turner authored
      This adds various new functionality and cleanup surrounding the
      use of the Stream library.  Major changes include:
      
      * Renaming of all classes for more consistency / meaningfulness
      * Addition of some new methods for reading multiple values at once.
      * Full suite of unit tests for reader / writer functionality.
      * Full set of doxygen comments for all classes.
      * Streams now store their own endianness.
      * Fixed some bugs in a few of the classes that were discovered
        by the unit tests.
      
      llvm-svn: 296215
      af299ea5
    • Vedant Kumar's avatar
      [ubsan] Detect signed overflow UB in remainder operations · 42de3807
      Vedant Kumar authored
      Teach ubsan to diagnose remainder operations which have undefined
      behavior due to signed overflow (e.g INT_MIN % -1).
      
      Differential Revision: https://reviews.llvm.org/D29437
      
      llvm-svn: 296214
      42de3807
    • Vedant Kumar's avatar
      [ubsan] Omit superflous overflow checks for promoted arithmetic (PR20193) · 82ee16be
      Vedant Kumar authored
      C requires the operands of arithmetic expressions to be promoted if
      their types are smaller than an int. Ubsan emits overflow checks when
      this sort of type promotion occurs, even if there is no way to actually
      get an overflow with the promoted type.
      
      This patch teaches clang how to omit the superflous overflow checks
      (addressing PR20193).
      
      Testing: check-clang and check-ubsan.
      
      Differential Revision: https://reviews.llvm.org/D29369
      
      llvm-svn: 296213
      82ee16be