1. Aug 20, 2013
    • Craig Topper's avatar
      Add AVX-512 feature flag and knl cpu to clang. · ffb7180e
      Craig Topper authored
      llvm-svn: 188756
      ffb7180e
    • Michael Gottesman's avatar
      Teach selectiondag how to handle the stackprotectorcheck intrinsic. · b27f0f1f
      Michael Gottesman authored
      Previously, generation of stack protectors was done exclusively in the
      pre-SelectionDAG Codegen LLVM IR Pass "Stack Protector". This necessitated
      splitting basic blocks at the IR level to create the success/failure basic
      blocks in the tail of the basic block in question. As a result of this,
      calls that would have qualified for the sibling call optimization were no
      longer eligible for optimization since said calls were no longer right in
      the "tail position" (i.e. the immediate predecessor of a ReturnInst
      instruction).
      
      Then it was noticed that since the sibling call optimization causes the
      callee to reuse the caller's stack, if we could delay the generation of
      the stack protector check until later in CodeGen after the sibling call
      decision was made, we get both the tail call optimization and the stack
      protector check!
      
      A few goals in solving this problem were:
      
        1. Preserve the architecture independence of stack protector generation.
      
        2. Preserve the normal IR level stack protector check for platforms like
           OpenBSD for which we support platform specific stack protector
           generation.
      
      The main problem that guided the present solution is that one can not
      solve this problem in an architecture independent manner at the IR level
      only. This is because:
      
        1. The decision on whether or not to perform a sibling call on certain
           platforms (for instance i386) requires lower level information
           related to available registers that can not be known at the IR level.
      
        2. Even if the previous point were not true, the decision on whether to
           perform a tail call is done in LowerCallTo in SelectionDAG which
           occurs after the Stack Protector Pass. As a result, one would need to
           put the relevant callinst into the stack protector check success
           basic block (where the return inst is placed) and then move it back
           later at SelectionDAG/MI time before the stack protector check if the
           tail call optimization failed. The MI level option was nixed
           immediately since it would require platform specific pattern
           matching. The SelectionDAG level option was nixed because
           SelectionDAG only processes one IR level basic block at a time
           implying one could not create a DAG Combine to move the callinst.
      
      To get around this problem a few things were realized:
      
        1. While one can not handle multiple IR level basic blocks at the
           SelectionDAG Level, one can generate multiple machine basic blocks
           for one IR level basic block. This is how we handle bit tests and
           switches.
      
        2. At the MI level, tail calls are represented via a special return
           MIInst called "tcreturn". Thus if we know the basic block in which we
           wish to insert the stack protector check, we get the correct behavior
           by always inserting the stack protector check right before the return
           statement. This is a "magical transformation" since no matter where
           the stack protector check intrinsic is, we always insert the stack
           protector check code at the end of the BB.
      
      Given the aforementioned constraints, the following solution was devised:
      
        1. On platforms that do not support SelectionDAG stack protector check
           generation, allow for the normal IR level stack protector check
           generation to continue.
      
        2. On platforms that do support SelectionDAG stack protector check
           generation:
      
          a. Use the IR level stack protector pass to decide if a stack
             protector is required/which BB we insert the stack protector check
             in by reusing the logic already therein. If we wish to generate a
             stack protector check in a basic block, we place a special IR
             intrinsic called llvm.stackprotectorcheck right before the BB's
             returninst or if there is a callinst that could potentially be
             sibling call optimized, before the call inst.
      
          b. Then when a BB with said intrinsic is processed, we codegen the BB
             normally via SelectBasicBlock. In said process, when we visit the
             stack protector check, we do not actually emit anything into the
             BB. Instead, we just initialize the stack protector descriptor
             class (which involves stashing information/creating the success
             mbbb and the failure mbb if we have not created one for this
             function yet) and export the guard variable that we are going to
             compare.
      
          c. After we finish selecting the basic block, in FinishBasicBlock if
             the StackProtectorDescriptor attached to the SelectionDAGBuilder is
             initialized, we first find a splice point in the parent basic block
             before the terminator and then splice the terminator of said basic
             block into the success basic block. Then we code-gen a new tail for
             the parent basic block consisting of the two loads, the comparison,
             and finally two branches to the success/failure basic blocks. We
             conclude by code-gening the failure basic block if we have not
             code-gened it already (all stack protector checks we generate in
             the same function, use the same failure basic block).
      
      llvm-svn: 188755
      b27f0f1f
    • Craig Topper's avatar
      Fix formatting. No functional change. · 7a8cf010
      Craig Topper authored
      llvm-svn: 188746
      7a8cf010
    • Craig Topper's avatar
      Add AVX-512 and related features to the CPUID detection code. · e13a066c
      Craig Topper authored
      llvm-svn: 188745
      e13a066c
    • Craig Topper's avatar
      Move AVX and non-AVX replication inside a couple multiclasses to avoid... · fd2b3892
      Craig Topper authored
      Move AVX and non-AVX replication inside a couple multiclasses to avoid repeating each instruction for both individually.
      
      llvm-svn: 188743
      fd2b3892
    • Craig Topper's avatar
    • Bill Schmidt's avatar
      [PowerPC] More refactoring prior to real PPC emitPrologue/Epilogue changes. · f381afc9
      Bill Schmidt authored
      (Patch committed on behalf of Mark Minich, whose log entry follows.)
      
      This is a continuation of the refactorings performed in svn rev 188573
      (see that rev's comments for more detail).
      
      This is my stage 2 refactoring: I combined the emitPrologue() &
      emitEpilogue() PPC32 & PPC64 code into a single flow, simplifying a
      lot of the code since in essence the PPC32 & PPC64 code generation
      logic is the same, only the instruction forms are different (in most
      cases). This simplification is necessary because my functional changes
      (yet to come) add significant complexity, and without the
      simplification of my stage 2 refactoring, the overall complexity of
      both emitPrologue() & emitEpilogue() would have become almost
      intractable for most mortal programmers (like me).
      
      This submission was intended to be a pure refactoring (no functional
      changes whatsoever). However, in the process of combining the PPC32 &
      PPC64 flows, I spotted a difference that I believe is a bug (see svn
      rev 186478 line 863, or svn rev 188573 line 888): This line appears to
      be restoring the BP with the original FP content, not the original BP
      content. When I merged the 32-bit and 64-bit code, I used the
      corresponding code from the 64-bit flow, which I believe uses the
      correct offset (BPOffset) for this operation.
      
      llvm-svn: 188741
      f381afc9
    • Andrew Kaylor's avatar
      Marking MCJIT PIC tests as XFAIL on AArch64 · e0c8f50f
      Andrew Kaylor authored
      llvm-svn: 188740
      e0c8f50f
    • David Blaikie's avatar
      Revert "Revert "Revert "Revert "DebugInfo: Omit debug info for dynamic classes... · 6943dea3
      David Blaikie authored
      Revert "Revert "Revert "Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class""""
      
      This reverts commit r188687 (reverts r188642 (reverts 188600 (reverts
      188576))).
      
      With added test coverage & fix for -gline-tables-only.
      
      Thanks Michael Gottesman for reverting this patch when it demonstrated
      problems & providing a reproduction/details to help me track this down.
      
      llvm-svn: 188739
      6943dea3
    • Venkatraman Govindaraju's avatar
      [Sparc] Use HWEncoding instead of unused Num field in Sparc register... · f625773b
      Venkatraman Govindaraju authored
      [Sparc] Use HWEncoding instead of unused Num field in Sparc register definitions. Also, correct the definitions of RETL and RET instructions.
      
      llvm-svn: 188738
      f625773b
    • Eli Friedman's avatar
      Fix name lookup with dependent using decls. · 0eaf10bc
      Eli Friedman authored
      We previously mishandled UnresolvedUsingValueDecls in
      NamedDecl::declarationReplaces, which caused us to forget decls
      when there are multiple dependent using decls for the same name.
      
      Fixes PR16936.
      
      llvm-svn: 188737
      0eaf10bc
    • Andrew Kaylor's avatar
      Fixing XPASSes among MCJIT PIC test on i686 · ef7280c7
      Andrew Kaylor authored
      llvm-svn: 188736
      ef7280c7
    • Andrew Kaylor's avatar
      Second attempt to mark Large/PIC MCJIT test as XFAIL for PowerPC64 · 99974313
      Andrew Kaylor authored
      llvm-svn: 188735
      99974313
    • Andrew Kaylor's avatar
      Marking two MCJIT PIC tests as XFAIL on Darwin · 23933892
      Andrew Kaylor authored
      llvm-svn: 188734
      23933892
    • Fariborz Jahanian's avatar
      ObjectiveC migrator: More work towards · d38ad47c
      Fariborz Jahanian authored
      insertion of ObjC audit pragmas.
      
      llvm-svn: 188733
      d38ad47c
    • Reid Kleckner's avatar
      clang-cl: Ignore the /wd n flag for disabling a warning · f9486598
      Reid Kleckner authored
      Clang doesn't have a table mapping cl.exe to clang warnings.  While some
      warnings like -Wsign-compare exist in both compilers, the majority do
      not correspond and should usually be ignored.
      
      llvm-svn: 188732
      f9486598
    • Jordan Rose's avatar
      [analyzer] Note that deadcode.UnmodifiedVariable would be an opt-in checker. · 6f937e9a
      Jordan Rose authored
      Website-only change.
      
      llvm-svn: 188731
      6f937e9a
    • Andrew Kaylor's avatar
      Trying again with PIC tests for MCJIT · c4c1ff6d
      Andrew Kaylor authored
      llvm-svn: 188730
      c4c1ff6d
    • Reid Kleckner's avatar
      clang-cl: Add /MP[n] to the list of unsupported and ignored flags · a04cdbb9
      Reid Kleckner authored
      This flag tells cl.exe to use up to n processes to compile the provided
      source files.  I have no plans to implement this in clang.
      
      llvm-svn: 188729
      a04cdbb9
    • Hal Finkel's avatar
      Add a llvm.copysign intrinsic · 0c5c01aa
      Hal Finkel authored
      This adds a llvm.copysign intrinsic; We already have Libfunc recognition for
      copysign (which is turned into the FCOPYSIGN SDAG node). In order to
      autovectorize calls to copysign in the loop vectorizer, we need a corresponding
      intrinsic as well.
      
      In addition to the expected changes to the language reference, the loop
      vectorizer, BasicTTI, and the SDAG builder (the intrinsic is transformed into
      an FCOPYSIGN node, just like the function call), this also adds FCOPYSIGN to a
      few lists in LegalizeVector{Ops,Types} so that vector copysigns can be
      expanded.
      
      In TargetLoweringBase::initActions, I've made the default action for FCOPYSIGN
      be Expand for vector types. This seems correct for all in-tree targets, and I
      think is the right thing to do because, previously, there was no way to generate
      vector-values FCOPYSIGN nodes (and most targets don't specify an action for
      vector-typed FCOPYSIGN).
      
      llvm-svn: 188728
      0c5c01aa
    • Hal Finkel's avatar
      Don't form PPC CTR-based loops around a copysignl call · 1cf48ab8
      Hal Finkel authored
      copysign/copysignf never become function calls (because the SDAG expansion code
      does not lower to the corresponding function call, but rather directly
      implements the associated logic), but copysignl almost always is lowered into a
      call to the requested libm functon (and, thus, might clobber CTR).
      
      llvm-svn: 188727
      1cf48ab8
    • Andrew Kaylor's avatar
      Adding PIC support for ELF on x86_64 platforms · 4612fed9
      Andrew Kaylor authored
      llvm-svn: 188726
      4612fed9
    • Peter Collingbourne's avatar
      f708c870
    • Juergen Ributzka's avatar
      Fix last commit. · 53e2f275
      Juergen Ributzka authored
      llvm-svn: 188724
      53e2f275
    • Jakub Staszak's avatar
      Use pop_back_val() instead of both back() and pop_back(). · b4eb6ade
      Jakub Staszak authored
      llvm-svn: 188723
      b4eb6ade
    • Juergen Ributzka's avatar
      Simplify code by using CreateMemTemp. No functional change intended. · c6ab1f8b
      Juergen Ributzka authored
      Reviewer: Eli
      llvm-svn: 188722
      c6ab1f8b
    • Matt Arsenault's avatar
      Teach InstCombine visitGetElementPtr about address spaces · d79f7d9e
      Matt Arsenault authored
      llvm-svn: 188721
      d79f7d9e
    • Matt Arsenault's avatar
      Cleanup visitGetElementPtr to make address space change easier · 98f34e3a
      Matt Arsenault authored
      llvm-svn: 188720
      98f34e3a
    • Matt Arsenault's avatar
      commonPointerCast cleanups to make address space change easier · 94a028aa
      Matt Arsenault authored
      llvm-svn: 188719
      94a028aa
    • Eli Friedman's avatar
      Handle init lists and _Atomic fields. · 4628cf76
      Eli Friedman authored
      Fixes PR16931.
      
      llvm-svn: 188718
      4628cf76
    • Jakub Staszak's avatar
      Make sure that pop_back_val() result is used. · fef9d0d1
      Jakub Staszak authored
      llvm-svn: 188717
      fef9d0d1
    • Richard Smith's avatar
      PR16727: don't try to evaluate a potentially value-dependent expression when · a6c8703e
      Richard Smith authored
      checking for missing parens in &&/|| expressions.
      
      llvm-svn: 188716
      a6c8703e
    • Andrew Kaylor's avatar
      Reverting r188709 until I can figure out the proper way to XFAIL it. · 28c23706
      Andrew Kaylor authored
      llvm-svn: 188715
      28c23706
    • Fariborz Jahanian's avatar
      ObjectiveC migrator: Start inserting · c6dfd3f8
      Fariborz Jahanian authored
      CF_IMPLICIT_BRIDGING_ENABLE/CF_IMPLICIT_BRIDGING_DISABLED
      pair. wip.
      
      llvm-svn: 188714
      c6dfd3f8
    • Matt Arsenault's avatar
      Fix assert with GEP ptr vector indexing structs · 74742a1b
      Matt Arsenault authored
      Also fix it calculating the wrong value. The struct index
      is not a ConstantInt, so it was being interpreted as an array
      index.
      
      llvm-svn: 188713
      74742a1b
    • Howard Hinnant's avatar
      93093224
    • Eric Christopher's avatar
      Use less verbose code and update comments. · 574b5c88
      Eric Christopher authored
      llvm-svn: 188711
      574b5c88
    • Matt Arsenault's avatar
      Revert non-test parts of r188507 · 5aeae18e
      Matt Arsenault authored
      Re-add the inboundsless tests I didn't add originally
      
      llvm-svn: 188710
      5aeae18e
    • Andrew Kaylor's avatar
      Adding tests for PIC with MCJIT · 93bf0870
      Andrew Kaylor authored
      llvm-svn: 188709
      93bf0870
    • Eric Christopher's avatar
      Turn on pubnames by default on linux. · 7da24888
      Eric Christopher authored
      Until gdb supports the new accelerator tables we should add the
      pubnames section so that gdb_index can be generated from gold
      at link time. On darwin we already emit the accelerator tables
      and so don't need to worry about pubnames.
      
      llvm-svn: 188708
      7da24888