Skip to content
  1. Aug 30, 2012
  2. Aug 29, 2012
    • Andrew Trick's avatar
      Preserve branch profile metadata during switch formation. · 3051aa1c
      Andrew Trick authored
      Patch by Michael Ilseman!
      This fixes SimplifyCFGOpt::FoldValueComparisonIntoPredecessors to preserve metata when folding conditional branches into switches.
      
      void foo(int x) {
        if (x == 0)
          bar(1);
        else if (__builtin_expect(x == 10, 1))
          bar(2);
        else if (x == 20)
          bar(3);
      }
      
      CFG:
      
      B0
      |  \
      |   X0
      B10
      |  \
      |   X10
      B20
      |  \
      E   X20
      
      Merge B0-B10:
      w(B0-X0) = w(B0-X0)*sum-weights(B10) = w(B0-X0) * (w(B10-X10) + w(B10-B20))
      w(B0-X10) = w(B0-B10) * w(B10-X10)
      w(B0-B20) = w(B0-B10) * w(B10-B20)
      
      B0 __
      | \  \
      | X10 X0
      B20
      |  \
      E  X20
      
      Merge B0-B20:
      w(B0-X0) = w(B0-X0) * sum-weights(B20) = w(B0-X0) * (w(B20-E) + w(B20-X20))
      w(B0-X10) = w(B0-X10) * sum-weights(B20) = ...
      w(B0-X20) = w(B0-B20) * w(B20-X20)
      w(B0-E) = w(B0-B20) * w(B20-E)
      
      llvm-svn: 162868
      3051aa1c
    • Andrew Trick's avatar
      whitespace · f3cf1932
      Andrew Trick authored
      llvm-svn: 162867
      f3cf1932
    • Eli Friedman's avatar
      Fix PR reference in test. · 8087378f
      Eli Friedman authored
      llvm-svn: 162866
      8087378f
    • Eli Friedman's avatar
      Fix run-line for test. · 9a38121f
      Eli Friedman authored
      llvm-svn: 162865
      9a38121f
    • Anna Zaks's avatar
      [analyzer]Fix typo, unbreak static analyzer BuildBot (at least · f329823d
      Anna Zaks authored
      partially).
      
      (Addresses a regression from r162790.)
      
      llvm-svn: 162864
      f329823d
    • Anna Zaks's avatar
      [analyzer] Improved diagnostic pruning for calls initializing values. · 5d4ec363
      Anna Zaks authored
      This heuristic addresses the case when a pointer (or ref) is passed
      to a function, which initializes the variable (or sets it to something
      other than '0'). On the branch where the inlined function does not
      set the value, we report use of undefined value (or NULL pointer
      dereference). The access happens in the caller and the path
      through the callee would get pruned away with regular path pruning. To
      solve this issue, we previously disabled diagnostic pruning completely
      on undefined and null pointer dereference checks, which entailed very
      verbose diagnostics in most cases. Furthermore, not all of the
      undef value checks had the diagnostic pruning disabled.
      
      This patch implements the following heuristic: if we pass a pointer (or
      ref) to the region (on which the error is reported) into a function and
      it's value is either undef or 'NULL' (and is a pointer), do not prune
      the function.
      
      llvm-svn: 162863
      5d4ec363
    • Eli Friedman's avatar
      Make alignment computation for pointer values for builtins handle · 504f9a28
      Eli Friedman authored
      non-pointer types with a pointer representation correctly. PR13660.
      
      llvm-svn: 162862
      504f9a28
    • Jakob Stoklund Olesen's avatar
      Rename hasVolatileMemoryRef() to hasOrderedMemoryRef(). · cea3e774
      Jakob Stoklund Olesen authored
      Ordered memory operations are more constrained than volatile loads and
      stores because they must be ordered with respect to all other memory
      operations.
      
      llvm-svn: 162861
      cea3e774
    • Greg Clayton's avatar
      <rdar://problem/11757916> · 1f746071
      Greg Clayton authored
      Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
      - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
      - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
      - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
      - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
      
      Cleaned up header includes a bit as well.
      
      llvm-svn: 162860
      1f746071
    • Jakob Stoklund Olesen's avatar
      Add MachineMemOperand::isUnordered(). · 23793141
      Jakob Stoklund Olesen authored
      This means the same as LoadInst/StoreInst::isUnordered(), and implies
      !isVolatile().
      
      Atomic loads and stored are also ordered, and this is the right method
      to check if it is safe to reorder memory operations. Ordered atomics
      can't be reordered wrt normal loads and stores, which is a stronger
      constraint than volatile.
      
      llvm-svn: 162859
      23793141
    • Simon Atanasyan's avatar
      Define __mips64 / __mips64__ macros for MIPS 64-bit targets. · c6a0be00
      Simon Atanasyan authored
      The patch suggested by Brad Smith.
      
      llvm-svn: 162858
      c6a0be00
    • Jakob Stoklund Olesen's avatar
      Don't move normal loads across volatile/atomic loads. · 813a109f
      Jakob Stoklund Olesen authored
      It is technically allowed to move a normal load across a volatile load,
      but probably not a good idea.
      
      It is not allowed to move a load across an atomic load with
      Ordering > Monotonic, and we model those with MOVolatile as well.
      
      I recently removed the mayStore flag from atomic load instructions, so
      they don't need a pseudo-opcode. This patch makes up for the difference.
      
      llvm-svn: 162857
      813a109f
    • Michael Liao's avatar
      fix C++ comment in C header · 84ee8bf3
      Michael Liao authored
      llvm-svn: 162856
      84ee8bf3
    • Bill Wendling's avatar
      Use the full path to output the .gcda file. · 11e61b95
      Bill Wendling authored
      This lets the user run the program from a different directory and still have the
      .gcda files show up in the correct place.
      <rdar://problem/12179524>
      
      llvm-svn: 162855
      11e61b95
    • Hal Finkel's avatar
      Reserve space for the mandatory traceback fields on PPC64. · 1859d265
      Hal Finkel authored
      We need to reserve space for the mandatory traceback fields,
      though leaving them as zero is appropriate for now.
      
      Although the ABI calls for these fields to be filled in fully, no
      compiler on Linux currently does this, and GDB does not read these
      fields.  GDB uses the first word of zeroes during exception handling to
      find the end of the function and the size field, allowing it to compute
      the beginning of the function.  DWARF information is used for everything
      else.  We need the extra 8 bytes of pad so the size field is found in
      the right place.
      
      As a comparison, GCC fills in a few of the fields -- language, number
      of saved registers -- but ignores the rest.  IBM's proprietary OSes do
      make use of the full traceback table facility.
      
      Patch by Bill Schmidt.
      
      llvm-svn: 162854
      1859d265
    • Simon Atanasyan's avatar
      Use getTargetDefines() virtual function in MipsTargetInfoBase successors · 16ee0057
      Simon Atanasyan authored
      to define all macros for MIPS targets. Remove redundant virtual function
      getArchDefines(). Two virtual functions for this task are really too much.
      
      llvm-svn: 162853
      16ee0057
    • Simon Atanasyan's avatar
      Factor out MIPS macro definitions common for all MIPS targets. · 683535bb
      Simon Atanasyan authored
      llvm-svn: 162852
      683535bb
    • Bill Wendling's avatar
      e8aee6b8
    • Hans Wennborg's avatar
      Move TLS check from LValueExprEvaluator::VisitVarDecl to · cb9ad990
      Hans Wennborg authored
      CheckLValueConstantExpression.
      
      Richard pointed out that using the address of a TLS variable is ok in a
      core C++11 constant expression, as long as it isn't part of the eventual
      result of constant expression evaluation. Having the check in
      CheckLValueConstantExpression accomplishes this.
      
      llvm-svn: 162850
      cb9ad990
    • Jakob Stoklund Olesen's avatar
      Verify the consistency of inline asm operands. · 7a837b9a
      Jakob Stoklund Olesen authored
      The operands on an INLINEASM machine instruction are divided into groups
      headed by immediate flag operands. Verify this structure.
      
      Extract verifyTiedOperands(), and only call it for non-inlineasm
      instructions.
      
      llvm-svn: 162849
      7a837b9a
    • Eric Christopher's avatar
      Clean this up slightly, doesn't really fall through. · 2a4e616d
      Eric Christopher authored
      llvm-svn: 162848
      2a4e616d
    • Fariborz Jahanian's avatar
      objective-C: make -Widiomatic-parentheses work · f07bcc52
      Fariborz Jahanian authored
      when assignment expression in conditional invloves
      property reference. // rdar://11066598
      
      llvm-svn: 162846
      f07bcc52
    • Alexander Kornienko's avatar
      Fixed a problem with #pragma push_macro/pop_macro implementation. · c0b4928d
      Alexander Kornienko authored
      Summary:
      The problem was with the following sequence:
        #pragma push_macro("long")
        #undef long
        #pragma pop_macro("long")
      in case when "long" didn't represent a macro.
      Fixed crash and removed code duplication for #undef/pop_macro case. Added regression tests.
      
      Reviewers: doug.gregor, klimek
      
      Reviewed By: doug.gregor
      
      CC: cfe-commits, chapuni
      
      Differential Revision: http://llvm-reviews.chandlerc.com/D31
      
      llvm-svn: 162845
      c0b4928d
    • Tim Northover's avatar
    • Benjamin Kramer's avatar
      Make helper function static. · 8f5c5ded
      Benjamin Kramer authored
      llvm-svn: 162843
      8f5c5ded
    • Alexey Samsonov's avatar
      [ASan] fix flakiness of Linux-specific clone_test: waitpid should better be... · 608a4b5d
      Alexey Samsonov authored
      [ASan] fix flakiness of Linux-specific clone_test: waitpid should better be provided with __WCLONE option, otherwise it didn't wait for the subprocess, returned -1, and we went crushing the subprocess stack
      
      llvm-svn: 162842
      608a4b5d
    • Benjamin Kramer's avatar
      Make MemoryBuiltins aware of TargetLibraryInfo. · 8bcc9711
      Benjamin Kramer authored
      This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
      is specified. This has been a problem for a long time but became more severe
      with the recent memory builtin improvements.
      
      Since the memory builtin functions are used everywhere, this required passing
      TLI in many places. This means that functions that now have an optional TLI
      argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
      mallocs anymore if the TLI argument is missing. I've updated most passes to do
      the right thing.
      
      Fixes PR13694 and probably others.
      
      llvm-svn: 162841
      8bcc9711
    • Simon Atanasyan's avatar
      Define _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets. · 5a0642fd
      Simon Atanasyan authored
      The patch suggested by Logan Chien.
      
      llvm-svn: 162840
      5a0642fd
Loading