1. Jul 02, 2014
  2. Jul 01, 2014
    • Benjamin Kramer's avatar
      Remove unused typedef. GCC warns about this. · f2c4baf0
      Benjamin Kramer authored
      llvm-svn: 212105
      f2c4baf0
    • David Majnemer's avatar
      GlobalOpt: Don't swap private for internal linkage · 5c921159
      David Majnemer authored
      There were transforms whose *intent* was to downgrade the linkage of
      external objects to have internal linkage.
      
      However, it fired on things with private linkage as well.
      
      llvm-svn: 212104
      5c921159
    • David Majnemer's avatar
      GlobalOpt: FileCheck-ize test · 9797abb0
      David Majnemer authored
      No functionality change.
      
      llvm-svn: 212103
      9797abb0
    • Benjamin Kramer's avatar
      0e184846
    • Rafael Espindola's avatar
      Avoid revocations when possible. · 83120cdf
      Rafael Espindola authored
      This is a small targeted fix for pr20119. The code needs quiet a bit of
      refactoring and I added some FIXMEs about it, but I want to get the testcase
      passing first.
      
      llvm-svn: 212101
      83120cdf
    • Quentin Colombet's avatar
      [PeepholeOptimizer] Advanced rewriting of copies to avoid cross register banks · 1111e6fe
      Quentin Colombet authored
      copies.
      
      This patch extends the peephole optimization introduced in r190713 to produce
      register-coalescer friendly copies when possible.
      
      This extension taught the existing cross-bank copy optimization how to deal
      with the instructions that generate cross-bank copies, i.e., insert_subreg,
      extract_subreg, reg_sequence, and subreg_to_reg.
      E.g.
      b = insert_subreg e, A, sub0 <-- cross-bank copy
      ...
      C = copy b.sub0 <-- cross-bank copy
      
      Would produce the following code:
      b = insert_subreg e, A, sub0 <-- cross-bank copy
      ...
      C = copy A <-- same-bank copy
      
      This patch also introduces a new helper class for that: ValueTracker.
      This class implements the logic to look through the copy related instructions
      and get the related source.
      
      For now, the advanced rewriting is disabled by default as we are lacking the
      semantic on target specific instructions to catch the motivating examples.
      
      Related to <rdar://problem/12702965>.
      
      llvm-svn: 212100
      1111e6fe
    • Quentin Colombet's avatar
      [RegAllocGreedy] Provide a flag to disable the local reassignment heuristic. · e1a36634
      Quentin Colombet authored
      By default, no functionality change.
      
      Before evicting a local variable, this heuristic tries to find another (set of)
      local(s) that can be reassigned to a free color.
      
      In some extreme cases (large basic blocks with tons of local variables), the
      compilation time is dominated by the local interference checks that this
      heuristic must perform, with no code gen gain.
      E.g., the motivating example takes 4 minutes to compile with this heuristic, 12
      seconds without.
      
      Improving the situation will likely require to make drastic changes to the
      register allocator and/or the interference check framework.
      
      For now, provide this flag to better understand the impact of that heuristic.
      
      <rdar://problem/17444599>
      
      llvm-svn: 212099
      e1a36634
    • Logan Chien's avatar
      Remove CleanupHackLevel from CGException. · e9c8ccbf
      Logan Chien authored
      This patch removes the dead code, and refines the
      getEHResumeBlock() slightly.
      
      The CleanupHackLevel was a hack to the old exception
      handling intrinsics, which have several issues with function
      inliner.
      
      Since LLVM 3.0, the new landingpad and resume instructions
      are added to LLVM IR.  With the new exception handling
      mechanism, most of the issues are fixed now.  We should
      always use these instructions to implement the exception
      handling code nowadays, and we don't need the hack any more.
      
      Besides, the `CleanupHackLevel` is a compile-time constant,
      thus other cases have been considered as dead code for a while.
      
      llvm-svn: 212097
      e9c8ccbf
    • Simon Atanasyan's avatar
      [Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi" · ad80595b
      Simon Atanasyan authored
      command line option only. Internally we convert them to the "o32" and "n64"
      respectively. So we do not need to refer them anywhere after that conversion.
      
      No functional changes.
      
      llvm-svn: 212096
      ad80595b
    • Alp Toker's avatar
      Remove obsolete function TargetRegistry::getClosestTargetForJIT() · 1a9ea52e
      Alp Toker authored
      This was kept around "for compatibility through 2.6" in 2009 and is not used or
      tested.
      
      llvm-svn: 212095
      1a9ea52e
    • Tim Northover's avatar
      [mach-o]: make the default dylib install-name the output filename. · 9bdf90e5
      Tim Northover authored
      llvm-svn: 212094
      9bdf90e5
    • Tim Northover's avatar
      [mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile · 301c4e69
      Tim Northover authored
      It still needs to be tied into BinaryReader, but this allows reasonably
      sensible creation of SharedLibrary atoms on MachO.
      
      llvm-svn: 212093
      301c4e69
    • Gerolf Hoflehner's avatar
      Enable test/CodeGen/indirect-goto.c in 64b for local arrays · 012dff0b
      Gerolf Hoflehner authored
      In 32b mode the reference count for block addresses
      is not zero. This prevents inlining and constant
      folding and causes the test to fail. Changing
      the triple allows runnning the test in 64b mode.
      
      The array in foo2 is now local instead of static until
      at lower optimization levels the interprocedural constant
      propagator is invoked before the global optimizer.
      
      llvm-svn: 212092
      012dff0b
    • Bob Wilson's avatar
      Temporarily disable the indirect-goto.c test. · 84941b92
      Bob Wilson authored
      llvm r212077 causes this test to fail. We need to reorder some passes and
      possibly make other changes to reenable the optimization being tested here.
      
      llvm-svn: 212091
      84941b92
    • Nikola Smiljanic's avatar
    • David Blaikie's avatar
      Revert "DebugInfo: Ensure that all debug location scope chains from... · c8caa170
      David Blaikie authored
      Revert "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."
      
      This reverts commit r212085.
      
      This breaks the sanitizer bot... & I thought I'd tried pretty hard not
      to do that. Guess I need to try harder.
      
      llvm-svn: 212089
      c8caa170
    • Andrew Trick's avatar
      MachineScheduler: better book-keeping for asserts. · f1b307bc
      Andrew Trick authored
      Fixes another test case under PR20057.
      
      llvm-svn: 212088
      f1b307bc
    • Alp Toker's avatar
      clang-interpreter: use LLVM interpreter if JIT is unavailable · 60c88cbf
      Alp Toker authored
      Update the strategy in r212083 to try JIT first and otherwise fall back to the
      interpreter. This gives the best of both worlds and still builds fine with no
      targets enabled.
      
      Requires supporting changes from LLVM r212086.
      
      llvm-svn: 212087
      60c88cbf
    • Alp Toker's avatar
      ExecutionEngine::create(): fix interpreter fallback when JIT is unavailable · 568c31f2
      Alp Toker authored
      ForceInterpreter=false shouldn't disable the interpreter completely because it
      can still be necessary to interpret if the target doesn't support JIT.
      
      No obvious way to test this in LLVM, but this matches what
      LLVMCreateExecutionEngineForModule() does and fixes the clang-interpreter
      example in the clang source tree which uses the ExecutionEngine.
      
      llvm-svn: 212086
      568c31f2
    • David Blaikie's avatar
      DebugInfo: Ensure that all debug location scope chains from instructions... · b89e6d93
      David Blaikie authored
      DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.
      
      Originally committed in r211723, reverted in r211724 due to failure
      cases found and fixed (ArgumentPromotion: r211872, Inlining: r212065),
      and I now believe the invariant actually holds for some reasonable
      amount of code (but I'll keep an eye on the buildbots and see what
      happens... ).
      
      Original commit message:
      
      PR20038: DebugInfo: Inlined call sites where the caller has debug info
      but the call itself has no debug location.
      
      This situation does bad things when inlined, so I've fixed Clang not to
      produce inlinable call sites without locations when the caller has debug
      info (in the one case where I could find that this occurred). This
      updates the PR20038 test case to be what clang now produces, and readds
      the assertion that had to be removed due to this bug.
      
      I've also beefed up the debug info verifier to help diagnose these
      issues in the future, and I hope to add checks to the inliner to just
      assert-fail if it encounters this situation. If, in the future, we
      decide we have to cope with this situation, the right thing to do is
      probably to just remove all the DebugLocs from the inlined instructions.
      
      llvm-svn: 212085
      b89e6d93
    • Alp Toker's avatar
      driver: add link dependency on CodeGen · e8aa4b90
      Alp Toker authored
      Fix the build when no targets are enabled. This dependency is incurred by two
      unfortunate entries in LinkAllPasses.h included from cc1_main.cpp:
      
        llvm::createJumpInstrTablesPass();
        llvm::createCodeGenPreparePass();
      
      llvm-svn: 212084
      e8aa4b90
    • Alp Toker's avatar
      clang-interpreter: interpret instead of JITing · 475f282b
      Alp Toker authored
      Fixes the build when no targets are selected, or no native target is built.
      
      This also better matches up with the description/title of the example and
      demonstrates how clang can be used to run C++ on constrained environments
      without file IO or executable memory permissions (e.g. iOS apps).
      
      A comment is added explaining how to extend the demo with JIT support as
      needed.
      
      llvm-svn: 212083
      475f282b
    • Alexey Samsonov's avatar
      Add the way to disable MSan unit tests for _mm_* intrinsics · c0fda339
      Alexey Samsonov authored
      llvm-svn: 212082
      c0fda339
    • Reid Kleckner's avatar
      Fix .seh_stackalloc 0 · b5dd9452
      Reid Kleckner authored
      seh_stackalloc 0 is not representable in Win64 SEH info, so emitting it
      is a bug.
      
      Reviewers: rnk
      
      Differential Revision: http://reviews.llvm.org/D4334
      
      Patch by Vadim Chugunov!
      
      llvm-svn: 212081
      b5dd9452
    • Johannes Doerfert's avatar
      [FIX] Don't consider reductions which are partially outside the SCoP · 9890a052
      Johannes Doerfert authored
        + Test case
      
      llvm-svn: 212080
      9890a052
    • David Majnemer's avatar
      GlobalOpt: Handle non-zero offsets for aliases · 0e2cc2a5
      David Majnemer authored
      An alias with an aliasee of a non-zero GEP is not trivially replacable
      with it's aliasee.
      
      llvm-svn: 212079
      0e2cc2a5
    • David Majnemer's avatar
      IR: Add a helper to check for LinkOnceODRLinkage · 5bfe75cf
      David Majnemer authored
      llvm-svn: 212078
      5bfe75cf
    • Gerolf Hoflehner's avatar
      Suppress inlining when the block address is taken · 734f4c89
      Gerolf Hoflehner authored
      Inlining functions with block addresses can cause many problem and requires a
      rich infrastructure to support including escape analysis.  At this point the
      safest approach to address these problems is by blocking inlining from
      happening.
      
      Background:
      There have been reports on Ruby segmentation faults triggered by inlining
      functions with block addresses like
      
      //Ruby code snippet
      vm_exec_core() {
          finish_insn_seq_0 = &&INSN_LABEL_finish;
          INSN_LABEL_finish:
            ;
      }
      
      This kind of scenario can also happen when LLVM picks a subset of blocks for
      inlining, which is the case with the actual code in the Ruby environment.
      
      LLVM suppresses inlining for such functions when there is an indirect branch.
      The attached patch does so even when there is no indirect branch.  Note that
      user code like above would not make much sense: using the global for jumping
      across function boundaries would be illegal.
      
      Why was there a segfault:
      
      In the snipped above the block with the label is recognized as dead So it is
      eliminated. Instead of a block address the cloner stores a constant (sic!) into
      the global resulting in the segfault (when the global is used in a goto).
      
      Why had it worked in the past then:
      
      By luck. In older versions vm_exec_core was also inlined but the label address
      used was the block label address in vm_exec_core.  So the global jump ended up
      in the original function rather than in the caller which accidentally happened
      to work.
      
      Test case ./tools/clang/test/CodeGen/indirect-goto.c will fail as a result
      of this commit.
      
      rdar://17245966
      
      llvm-svn: 212077
      734f4c89
    • Zachary Turner's avatar
      Fix Windows build after llgs upstream. · 0ec7baa9
      Zachary Turner authored
      With _HAS_EXCEPTIONS=0, Windows' version of <thread> will fail to
      compile because it calls __uncaught_exception(), which is compiled
      out due to _HAS_EXCEPTIONS=0.  This just creates a stub version
      of __uncaught_exception() which always fails.
      
      llvm-svn: 212076
      0ec7baa9
    • Duncan P. N. Exon Smith's avatar
      AArch64: Follow-up to r212073 · 4f5e9f82
      Duncan P. N. Exon Smith authored
      In r212073 I missed a call of `use_begin()` that assumed the wrong
      semantics.  It's not clear to me at all what this code does without the
      fix, so I'm not sure how to write a testcase.
      
      llvm-svn: 212075
      4f5e9f82
    • Todd Fiala's avatar
      Fixup Windows build breaks for the llgs upstream. · 2850b1be
      Todd Fiala authored
      Also moves NativeRegisterContextLinux* files into the Linux directory.
      These, like NativeProcessLinux, should only be built on Linux or a cross
      compiler with proper headers.
      
      llvm-svn: 212074
      2850b1be
    • Duncan P. N. Exon Smith's avatar
      AArch64: Actually do address type promotion · 7d7ae931
      Duncan P. N. Exon Smith authored
      AArch64AddressTypePromotion was doing nothing because it was using the
      old semantics of `Use` and `uses()`, when it really wanted to get at the
      `users()`.
      
      llvm-svn: 212073
      7d7ae931