platform/upstream/llvm.git
11 years agoFix a bug where we would move a following line into a comment.
Daniel Jasper [Wed, 16 Jan 2013 17:00:50 +0000 (17:00 +0000)]
Fix a bug where we would move a following line into a comment.

Before: Constructor() : a(a), // comment a(a) {}
After:  Constructor() : a(a), // comment
                        a(a) {}

Needed this as a quick fix. Will add more tests for this in a future
commit.

llvm-svn: 172624

11 years ago[preprocessor] Call the MacroUndefined callback even when the macro was not defined.
Argyrios Kyrtzidis [Wed, 16 Jan 2013 16:52:44 +0000 (16:52 +0000)]
[preprocessor] Call the MacroUndefined callback even when the macro was not defined.

Patch by Enea Zaffanella!

llvm-svn: 172623

11 years agoReplace virtual hasFixups with explicit fragment type checks
Eli Bendersky [Wed, 16 Jan 2013 16:52:08 +0000 (16:52 +0000)]
Replace virtual hasFixups with explicit fragment type checks

llvm-svn: 172622

11 years agoFix parsing error in conditional expressions.
Daniel Jasper [Wed, 16 Jan 2013 16:23:19 +0000 (16:23 +0000)]
Fix parsing error in conditional expressions.

We used to incorrectly parse

aaaaaa ? aaaaaa(aaaaaa) : aaaaaaaa;

Due to an l_paren being followed by a colon, we assumed it to be part of
a constructor initializer. Thus, we never found the colon belonging to
the conditional expression, marked the line as bing incorrect and did
not format it.

llvm-svn: 172621

11 years ago[PCH/Modules] Change how macro [re]definitions are de/serialized.
Argyrios Kyrtzidis [Wed, 16 Jan 2013 16:19:38 +0000 (16:19 +0000)]
[PCH/Modules] Change how macro [re]definitions are de/serialized.

Previously we would serialize the macro redefinitions as a list, part of
the identifier, and try to chain them together across modules individually
without having the info that they were already chained at definition time.

Change this by serializing the macro redefinition chain and then try
to synthesize the chain parts across modules. This allows us to correctly
pinpoint when 2 different definitions are ambiguous because they came from
unrelated modules.

Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH
is redefined without undef'ing it first.

rdar://13016031

llvm-svn: 172620

11 years agoImprove understanding of unary operators.
Daniel Jasper [Wed, 16 Jan 2013 16:04:06 +0000 (16:04 +0000)]
Improve understanding of unary operators.

Before: int x = ** a;
After:  int x = **a;
llvm-svn: 172619

11 years agoDisable inlining of short ifs in Google style.
Daniel Jasper [Wed, 16 Jan 2013 15:44:34 +0000 (15:44 +0000)]
Disable inlining of short ifs in Google style.

Various reasons seem to speak against it, so I am disabling this for
now.

Changed tests to still test this option.

llvm-svn: 172618

11 years agoAdd option to avoid "bin-packing" of parameters.
Daniel Jasper [Wed, 16 Jan 2013 14:59:02 +0000 (14:59 +0000)]
Add option to avoid "bin-packing" of parameters.

"Bin-packing" here means allowing multiple parameters on one line, if a
function call/declaration is spread over multiple lines.

This is required by the Chromium style guide and probably desired for
the Google style guide. Not making changes to LLVM style as I don't have
enough data.

With this enabled, we format stuff like:
aaaaaaaaaaaaaaa(aaaaaaaaaa,
                aaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();

llvm-svn: 172617

11 years agoAdd debugging support for split penalties.
Manuel Klimek [Wed, 16 Jan 2013 14:55:28 +0000 (14:55 +0000)]
Add debugging support for split penalties.

llvm-svn: 172616

11 years agoAllow vectors in CreatePointerCast of constants.
Evgeniy Stepanov [Wed, 16 Jan 2013 14:41:46 +0000 (14:41 +0000)]
Allow vectors in CreatePointerCast of constants.

llvm-svn: 172615

11 years agoA test for r172535.
Evgeniy Stepanov [Wed, 16 Jan 2013 14:38:50 +0000 (14:38 +0000)]
A test for r172535.

llvm-svn: 172614

11 years agoasan: fix ARM build
Dmitry Vyukov [Wed, 16 Jan 2013 14:35:13 +0000 (14:35 +0000)]
asan: fix ARM build

llvm-svn: 172613

11 years agoRemove unused leftover header (it moved to llvm/IR).
Benjamin Kramer [Wed, 16 Jan 2013 13:43:56 +0000 (13:43 +0000)]
Remove unused leftover header (it moved to llvm/IR).

llvm-svn: 172612

11 years agoMove test that depends on the x86 target into a target-specific directory.
Benjamin Kramer [Wed, 16 Jan 2013 13:25:56 +0000 (13:25 +0000)]
Move test that depends on the x86 target into a target-specific directory.

Should fix the arm buildbot (which only builds the arm target).

llvm-svn: 172611

11 years agoASan: wrap mapping scale and offset in a struct and make it a member of ASan passes...
Alexey Samsonov [Wed, 16 Jan 2013 13:23:28 +0000 (13:23 +0000)]
ASan: wrap mapping scale and offset in a struct and make it a member of ASan passes. Add test for non-default mapping scale and offset. No functionality change

llvm-svn: 172610

11 years agoRemove triple from this test, it makes it fail when X86 TTI is missing.
Benjamin Kramer [Wed, 16 Jan 2013 13:19:59 +0000 (13:19 +0000)]
Remove triple from this test, it makes it fail when X86 TTI is missing.

Without a triple opt falls back to NoTTI which comes closer to LSR's pre-TTI behavior.

llvm-svn: 172609

11 years agoUse standard llvm Debug.h support for debugging output.
Manuel Klimek [Wed, 16 Jan 2013 12:31:12 +0000 (12:31 +0000)]
Use standard llvm Debug.h support for debugging output.

Leave a quick "// Uncomment this." hint to enable the debug output in
tests. FIXME: figure out whether we want to enable debug command line
handling for all tests.

llvm-svn: 172608

11 years agoClang Format: A couple of tests for the trailing stuff case
Alexander Kornienko [Wed, 16 Jan 2013 11:45:16 +0000 (11:45 +0000)]
Clang Format: A couple of tests for the trailing stuff case

llvm-svn: 172607

11 years agoClang Format: Handle missing semicolon
Alexander Kornienko [Wed, 16 Jan 2013 11:43:46 +0000 (11:43 +0000)]
Clang Format: Handle missing semicolon

llvm-svn: 172606

11 years agoFix uninitialized bool flag access in SanitizerArgs parser
Alexey Samsonov [Wed, 16 Jan 2013 11:34:36 +0000 (11:34 +0000)]
Fix uninitialized bool flag access in SanitizerArgs parser

llvm-svn: 172605

11 years agoCalculate the total length of a line up to each token up front.
Daniel Jasper [Wed, 16 Jan 2013 10:41:46 +0000 (10:41 +0000)]
Calculate the total length of a line up to each token up front.

This makes the tedious fitsIntoLimit() method unnecessary and I can
replace one hack (constructor initializers) by a slightly better hack.

Furthermore, this will enable calculating whether a certain part of a
line fits into the limit for future modifications.

llvm-svn: 172604

11 years ago[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated...
Kostya Serebryany [Wed, 16 Jan 2013 09:12:14 +0000 (09:12 +0000)]
[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated chunk in case there is an old memalign magic)

llvm-svn: 172603

11 years agoChange the datastructure for UnwrappedLines.
Daniel Jasper [Wed, 16 Jan 2013 09:10:19 +0000 (09:10 +0000)]
Change the datastructure for UnwrappedLines.

It was quite convoluted leading to us accidentally introducing O(N^2)
complexity while copying from UnwrappedLine to AnnotatedLine. We might
still want to improve the datastructure in AnnotatedLine (most
importantly not put them in a vector where they need to be copied on
vector resizing but that will be done as a follow-up.

This fixes most of the regression in llvm.org/PR14959.

No formatting changes intended.

llvm-svn: 172602

11 years agoNever merge < and ::, as it produces different tokens.
Daniel Jasper [Wed, 16 Jan 2013 07:19:28 +0000 (07:19 +0000)]
Never merge < and ::, as it produces different tokens.

Before: vector<::Type> t;
After:  vector< ::Type> t;
llvm-svn: 172601

11 years agoRemove errors were if statements were incorrectly put on a single line.
Daniel Jasper [Wed, 16 Jan 2013 07:02:34 +0000 (07:02 +0000)]
Remove errors were if statements were incorrectly put on a single line.

Before: if (a)  // This comment confused clang-format f();
After:  if (a)  // No more confusion
          f();
llvm-svn: 172600

11 years ago[ObjCARC] Turn off ignoring unwind edges in ObjCARC when -fno-objc-arc-exception...
Michael Gottesman [Wed, 16 Jan 2013 06:32:39 +0000 (06:32 +0000)]
[ObjCARC] Turn off ignoring unwind edges in ObjCARC when -fno-objc-arc-exception is enabled due to it's affect on correctness.

Specifically according to the semantics of ARC -fno-objc-arc-exception simply
states that it is expected that the unwind path out of a call *MAY* not release
objects. Thus we can have the situation where a release gets moved into a catch
block which we ignore when we remove a retain/release pair resulting in (even
though we assume the program is exiting anyways) the cleanup code path
potentially blowing up before program exit.

llvm-svn: 172599

11 years agoclang/test/Driver/darwin-sdkroot.c: Suppress this on msys bash, to introduce the...
NAKAMURA Takumi [Wed, 16 Jan 2013 06:10:16 +0000 (06:10 +0000)]
clang/test/Driver/darwin-sdkroot.c: Suppress this on msys bash, to introduce the feature "shell-preserves-root".

MSYS transforms '/' to 'X:/mingwroot/'.

llvm-svn: 172598

11 years ago[analyzer] Add an annotation to allow suppression of direct ivar
Anna Zaks [Wed, 16 Jan 2013 01:36:00 +0000 (01:36 +0000)]
[analyzer] Add an annotation to allow suppression of direct ivar
assignment

llvm-svn: 172597

11 years ago[analyzer] Fix warning typo.
Anna Zaks [Wed, 16 Jan 2013 01:35:57 +0000 (01:35 +0000)]
[analyzer] Fix warning typo.

llvm-svn: 172596

11 years ago[analyzer] Refactor: parameter rename.
Anna Zaks [Wed, 16 Jan 2013 01:35:54 +0000 (01:35 +0000)]
[analyzer] Refactor: parameter rename.

llvm-svn: 172595

11 years agoreverting 172579
Jack Carter [Wed, 16 Jan 2013 01:29:10 +0000 (01:29 +0000)]
reverting 172579

llvm-svn: 172594

11 years agoSDKROOT should only be unset/cleared for ARM builds. The first fix by Bob Wilson...
Greg Clayton [Wed, 16 Jan 2013 01:27:32 +0000 (01:27 +0000)]
SDKROOT should only be unset/cleared for ARM builds. The first fix by Bob Wilson removed it for ARM for both configure and make, but only unset it for desktop configure, not for the make. My next fix unset/cleared it all the time. This fix only unset/clears it for ARM builds.

llvm-svn: 172593

11 years agoAdd -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
Douglas Gregor [Wed, 16 Jan 2013 01:23:41 +0000 (01:23 +0000)]
Add -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
users can explicitly enable/disable modules autolinking.

llvm-svn: 172592

11 years agoCollect both normal and static data members of a class in source
Eric Christopher [Wed, 16 Jan 2013 01:22:32 +0000 (01:22 +0000)]
Collect both normal and static data members of a class in source
order. Describe static data members to metadata using new interfaces.

Part of PR14471.

Patch by Paul Robinson!

llvm-svn: 172591

11 years agoDefine metadata interfaces for describing a static data member
Eric Christopher [Wed, 16 Jan 2013 01:22:23 +0000 (01:22 +0000)]
Define metadata interfaces for describing a static data member
of a class. Emit static data member declarations and definitions
through correctly.

Part of PR14471.

Patch by Paul Robinson!

llvm-svn: 172590

11 years agoAdd a test for static member debug information.
Eric Christopher [Wed, 16 Jan 2013 01:22:09 +0000 (01:22 +0000)]
Add a test for static member debug information.

Part of PR14471.

Patch by Paul Robinson.

llvm-svn: 172589

11 years agoDocumentation: fix typo
Dmitri Gribenko [Wed, 16 Jan 2013 01:17:05 +0000 (01:17 +0000)]
Documentation: fix typo

llvm-svn: 172588

11 years agoDocument the redeclaration and overriding restrictions on the
Douglas Gregor [Wed, 16 Jan 2013 01:12:31 +0000 (01:12 +0000)]
Document the redeclaration and overriding restrictions on the
availability attribute.

llvm-svn: 172587

11 years agoOne can have an unavailable method overridden by an available method,
Douglas Gregor [Wed, 16 Jan 2013 00:54:48 +0000 (00:54 +0000)]
One can have an unavailable method overridden by an available method,
but not vice-versa. Fix bug introduced in r172567 and noticed by
Jordan, thanks!

llvm-svn: 172586

11 years agoApply adjustment to function- and array-typed non-type template
Douglas Gregor [Wed, 16 Jan 2013 00:52:15 +0000 (00:52 +0000)]
Apply adjustment to function- and array-typed non-type template
parameters (per C++ [temp.param]p8) when computing the type of a
reference to a non-type template parameter. Fixes <rdar://problem/13000548>.

llvm-svn: 172585

11 years agoUse the ExtensionDirectiveHandler type in other places where it makes sense.
Eli Bendersky [Wed, 16 Jan 2013 00:50:52 +0000 (00:50 +0000)]
Use the ExtensionDirectiveHandler type in other places where it makes sense.

Since we already have this type it's a shame to keep dragging a pair of object
and method around explicitly.

llvm-svn: 172584

11 years ago<rdar://problem/13019628>
Han Ming Ong [Wed, 16 Jan 2013 00:46:39 +0000 (00:46 +0000)]
<rdar://problem/13019628>

Prevent profiling from working on older debugserver. Just a simple renaming since the caller is prepared to handle the â€˜unimplemented’ answer.

llvm-svn: 172583

11 years agoFix clang builds that were broken due to SDKROOT changes of you have an internal...
Greg Clayton [Wed, 16 Jan 2013 00:41:14 +0000 (00:41 +0000)]
Fix clang builds that were broken due to SDKROOT changes of you have an internal OS build.

llvm-svn: 172582

11 years agoUse --enable-werror
David Greene [Wed, 16 Jan 2013 00:17:38 +0000 (00:17 +0000)]
Use --enable-werror

Use --enable-werror during configure time rather than
--with-extra-options.  This is cleaner and easier to read.

llvm-svn: 172581

11 years agoImprove r172577 by using the correct type when declaring constants
Dmitri Gribenko [Wed, 16 Jan 2013 00:14:15 +0000 (00:14 +0000)]
Improve r172577 by using the correct type when declaring constants

llvm-svn: 172580

11 years agoAkira,
Jack Carter [Wed, 16 Jan 2013 00:07:45 +0000 (00:07 +0000)]
Akira,

Hope you are feeling better.

The Mips RDHWR (Read Hardware Register) instruction was not
tested for assembler or dissassembler consumption. This patch
adds that functionality.

Contributer: Vladimir Medic

llvm-svn: 172579

11 years agoSplit address information for DWARF5 split dwarf proposal. This involves
Eric Christopher [Tue, 15 Jan 2013 23:56:56 +0000 (23:56 +0000)]
Split address information for DWARF5 split dwarf proposal. This involves
using the DW_FORM_GNU_addr_index and a separate .debug_addr section which
stays in the executable and is fully linked.

Sneak in two other small changes:

a) Print out the debug_str_offsets.dwo section.
b) Change form we're expecting the entries in the debug_str_offsets.dwo
   section to take from ULEB128 to U32.

Add tests for all of this in the fission-cu.ll test.

llvm-svn: 172578

11 years agoAvoid Enum Compare Warnings
David Greene [Tue, 15 Jan 2013 23:46:58 +0000 (23:46 +0000)]
Avoid Enum Compare Warnings

Avoid a compiler warning about comparing disjoint enums but casting
them to int first.

llvm-svn: 172577

11 years agoTeach InstCombine to optimize extract of a value from a vector add operation with...
Nadav Rotem [Tue, 15 Jan 2013 23:43:14 +0000 (23:43 +0000)]
Teach InstCombine to optimize extract of a value from a vector add operation with a constant zero.

llvm-svn: 172576

11 years agoFixes to the code I just committed to reflect
Sean Callanan [Tue, 15 Jan 2013 23:38:09 +0000 (23:38 +0000)]
Fixes to the code I just committed to reflect
that we now also have to ignore breakpoints
when running the expression to collect isas.

llvm-svn: 172575

11 years agoModified the Objective-C runtime to fetch Objective-C
Sean Callanan [Tue, 15 Jan 2013 23:33:42 +0000 (23:33 +0000)]
Modified the Objective-C runtime to fetch Objective-C
isas and corresponding names from the underlying process
in a manner much quicker than the current approach.

The current approach accesses memory in the underlying
process with a random-access pattern as it walks across
the data structures associated with each isa.  This
involves a great deal of back-and-forth with debugserver,
resulting in performance problems, especially with iOS
targets.

The new approach attempts to run an expression in the
target that collects the isas and names into two large
buffers, which LLDB then collects in one shot.

<rdar://problem/12914539>

llvm-svn: 172574

11 years agoClangExpressionVariable previously was not capable of
Sean Callanan [Tue, 15 Jan 2013 23:29:36 +0000 (23:29 +0000)]
ClangExpressionVariable previously was not capable of
handling multiple clients.  However, occasionally an
expression must be run in the service of another
expression, and in this case two parsers need to access
the same list of persistent variables.

To allow this, persistent variables now provide state
for multiple parsers, and parsers must allocate, access,
and deallocate this state by providing their own ID
(at the moment, simply the value of the "this" pointer).

<rdar://problem/12914539>

llvm-svn: 172573

11 years agoOptimize the memory usage of MC bundling, by creating a new type of fragment
Eli Bendersky [Tue, 15 Jan 2013 23:22:09 +0000 (23:22 +0000)]
Optimize the memory usage of MC bundling, by creating a new type of fragment
into which we can emit single instructions without fixups (which is most
instructions). This is an optimization required because MCDataFragment
is prety large (240 bytes on x64), with no change in functionality.

For large programs, this reduces memory usage overhead required for bundling
by 40%.

To make the code as palatable as possible, the MCEncodedFragment interface was
further fragmented (no pun intended) and MCEncodedFragmentWithFixups is used
as the interface to work against when the user expects fixups. MCDataFragment
and MCRelaxableFragment implement this interface, while the new
MCCompactEncodedInstFragment implements MCEncodeFragment.

llvm-svn: 172572

11 years agoFix signed/unsigned Compare
David Greene [Tue, 15 Jan 2013 23:13:49 +0000 (23:13 +0000)]
Fix signed/unsigned Compare

Do some casting to avoid a signed/unsigned compare.

llvm-svn: 172571

11 years agoAvoid unsigned Compare to int
David Greene [Tue, 15 Jan 2013 23:13:47 +0000 (23:13 +0000)]
Avoid unsigned Compare to int

Cast arithmetic results to avoid comparison of an unsigned to an int.

llvm-svn: 172570

11 years ago[ms-inline asm] Address the FIXME in AsmParser.cpp.
Chad Rosier [Tue, 15 Jan 2013 23:07:53 +0000 (23:07 +0000)]
[ms-inline asm] Address the FIXME in AsmParser.cpp.

// FIXME: Constraints are hard coded to 'm', but we need an 'r'
// constraint for addressof.  This needs to be cleaned up!

Test cases are already in place.  Specifically,
clang/test/CodeGen/ms-inline-asm.c t15(), t16(), and t24().

llvm-svn: 172569

11 years agoRefactor generic Asm directive parsing.
Eli Bendersky [Tue, 15 Jan 2013 22:59:42 +0000 (22:59 +0000)]
Refactor generic Asm directive parsing.

After discussing the refactoring with Jim and Daniel, the following changes were
made:

* All generic directive parsing is now done by AsmParser itself. The previous
  division between it and GenericAsmParser did not have clear boundaries and
  just produced unnatural code of GenericAsmParser juggling the internals of
  AsmParser through an interface.
  The division of responsibilities is now clear: target-specific directives,
  other extensions (used by platform-specific parseres), and generic directives.
* Priority for directive parsing was reshuffled to ask extensions first and
  check the generic directives later.

No change in functionality.

llvm-svn: 172568

11 years agoWhen checking availability attributes for consistency between an
Douglas Gregor [Tue, 15 Jan 2013 22:43:08 +0000 (22:43 +0000)]
When checking availability attributes for consistency between an
overriding and overridden method, allow the overridden method to have
a narrower contract (introduced earlier, deprecated/obsoleted later)
than the overriding method. Fixes <rdar://problem/12992023>.

llvm-svn: 172567

11 years ago<rdar://problem/13011717>
Greg Clayton [Tue, 15 Jan 2013 22:13:13 +0000 (22:13 +0000)]
<rdar://problem/13011717>

Fixed a compilation error where NULL was being assigned to a uint.

llvm-svn: 172566

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:51 +0000 (22:09 +0000)]
Fix Casting

Use const_cast<> to avoid a cast-away-const error.

llvm-svn: 172565

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:49 +0000 (22:09 +0000)]
Fix Casting

Use const_cast<> to avoid a cast-away-const error.

llvm-svn: 172564

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:48 +0000 (22:09 +0000)]
Fix Casting

Use const_cast<> to avoid a cast-away-const error.

llvm-svn: 172563

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:46 +0000 (22:09 +0000)]
Fix Casting

Use const_cast<> to avoid a cast-away-const error.

llvm-svn: 172562

11 years agoFix Cast
David Greene [Tue, 15 Jan 2013 22:09:45 +0000 (22:09 +0000)]
Fix Cast

Properly use const_cast to fix a cast-away-const error.

llvm-svn: 172561

11 years agoFix Casting
David Greene [Tue, 15 Jan 2013 22:09:43 +0000 (22:09 +0000)]
Fix Casting

Make the const_cast explicit to silence a compiler warning.

llvm-svn: 172560

11 years agoFix Const Cast
David Greene [Tue, 15 Jan 2013 22:09:41 +0000 (22:09 +0000)]
Fix Const Cast

Do proper casting to avoid a cast-away-const error.

llvm-svn: 172559

11 years agoFix Cast
David Greene [Tue, 15 Jan 2013 22:09:40 +0000 (22:09 +0000)]
Fix Cast

Avoid a cast-away-const error by properly using const_cast<>.

llvm-svn: 172558

11 years agoFix Cast Code
David Greene [Tue, 15 Jan 2013 22:09:39 +0000 (22:09 +0000)]
Fix Cast Code

Eliminate a cast and resulting cast-qual warning by using a temporary
as the target of memcpy.

llvm-svn: 172557

11 years ago[Object][ELF] Fix -Wenum-compare.
Michael J. Spencer [Tue, 15 Jan 2013 22:00:16 +0000 (22:00 +0000)]
[Object][ELF] Fix -Wenum-compare.

llvm-svn: 172556

11 years agoTypo correction; no functional change.
Aaron Ballman [Tue, 15 Jan 2013 21:59:46 +0000 (21:59 +0000)]
Typo correction; no functional change.

llvm-svn: 172555

11 years agoTrailing whitespace.
Michael J. Spencer [Tue, 15 Jan 2013 21:13:14 +0000 (21:13 +0000)]
Trailing whitespace.

llvm-svn: 172554

11 years ago[ELF] Never allocate content to weak symbols as they may be merged away.
Michael J. Spencer [Tue, 15 Jan 2013 21:13:02 +0000 (21:13 +0000)]
[ELF] Never allocate content to weak symbols as they may be merged away.

This is done by creating a new non-weak anonymous symbol and creating
an atom with content for that symbol. This is added after the weak symbol
so that they have the same address.

llvm-svn: 172553

11 years ago[ELF] Refactoring and style cleanup. No functionality change.
Michael J. Spencer [Tue, 15 Jan 2013 21:12:45 +0000 (21:12 +0000)]
[ELF] Refactoring and style cleanup. No functionality change.

llvm-svn: 172552

11 years ago1. Hoist minus sign as high as possible in an attempt to reveal
Shuxin Yang [Tue, 15 Jan 2013 21:09:32 +0000 (21:09 +0000)]
1. Hoist minus sign as high as possible in an attempt to reveal
   some optimization opportunities (in the enclosing supper-expressions).

   rule 1. (-0.0 - X ) * Y => -0.0 - (X * Y)
     if expression "-0.0 - X" has only one reference.

   rule 2. (0.0 - X ) * Y => -0.0 - (X * Y)
     if expression "0.0 - X" has only one reference, and
        the instruction is marked "noSignedZero".

2. Eliminate negation (The compiler was already able to handle these
    opt if the 0.0s are replaced with -0.0.)

   rule 3: (0.0 - X) * (0.0 - Y) => X * Y
   rule 4: (0.0 - X) * C => X * -C
   if the expr is flagged "noSignedZero".

3.
  Rule 5: (X*Y) * X => (X*X) * Y
   if X!=Y and the expression is flagged with "UnsafeAlgebra".

   The purpose of this transformation is two-fold:
    a) to form a power expression (of X).
    b) potentially shorten the critical path: After transformation, the
       latency of the instruction Y is amortized by the expression of X*X,
       and therefore Y is in a "less critical" position compared to what it
      was before the transformation.

4. Remove the InstCombine code about simplifiying "X * select".

   The reasons are following:
    a) The "select" is somewhat architecture-dependent, therefore the
       higher level optimizers are not able to precisely predict if
       the simplification really yields any performance improvement
       or not.

    b) The "select" operator is bit complicate, and tends to obscure
       optimization opportunities. It is btter to keep it as low as
       possible in expr tree, and let CodeGen to tackle the optimization.

llvm-svn: 172551

11 years ago[Linker] Drop asserts that are embedded in cast<> and now checked by the verifier.
Daniel Dunbar [Tue, 15 Jan 2013 20:52:09 +0000 (20:52 +0000)]
[Linker] Drop asserts that are embedded in cast<> and now checked by the verifier.

llvm-svn: 172550

11 years ago[IR] Add verification for module flags with the "require" behavior.
Daniel Dunbar [Tue, 15 Jan 2013 20:52:06 +0000 (20:52 +0000)]
[IR] Add verification for module flags with the "require" behavior.

llvm-svn: 172549

11 years ago[driver/Darwin] Adjust SDKROOT handling code to not generate "-isysroot /".
Daniel Dunbar [Tue, 15 Jan 2013 20:33:56 +0000 (20:33 +0000)]
[driver/Darwin] Adjust SDKROOT handling code to not generate "-isysroot /".

llvm-svn: 172548

11 years agoAdd temporary option to invert the */& binding in a specific style.
Daniel Jasper [Tue, 15 Jan 2013 18:56:19 +0000 (18:56 +0000)]
Add temporary option to invert the */& binding in a specific style.

This is temporarily necessary until styles are configurable through files
as it seems to be a contentious issue.

llvm-svn: 172546

11 years agoAdd a test for -Wsemicolon-before-method-body fixit
Dmitri Gribenko [Tue, 15 Jan 2013 18:29:04 +0000 (18:29 +0000)]
Add a test for -Wsemicolon-before-method-body fixit

llvm-svn: 172545

11 years agoLoopVectorizer cost model. Honor the user command line flag that selects the vectoriz...
Nadav Rotem [Tue, 15 Jan 2013 18:25:16 +0000 (18:25 +0000)]
LoopVectorizer cost model. Honor the user command line flag that selects the vectorization factor even if the target machine does not have any vector registers.

llvm-svn: 172544

11 years agoDisable Uninitialized Use Warnings for Broken gcc Versions
David Greene [Tue, 15 Jan 2013 18:21:15 +0000 (18:21 +0000)]
Disable Uninitialized Use Warnings for Broken gcc Versions

Some versions of gcc accept unsupported -W flags and run just fine if
there are no warnings, but die with an unsupported flag error if a
warning is encountered.  gcc 4.3 and gcc 4.4 both exhibit this
behavior for -Wno-maybe-uninitialized.  Therefore, if the flag check
for -Wno-maybe-uninitialized succeeds, only use
-Wno-maybe-uninitialized if we are using gcc version 4.7 or greater.
Use -Wno-uninitialized otherwise.

llvm-svn: 172543

11 years agoOptimize basic_ostream::write by having it call sputn instead of sputc.
Howard Hinnant [Tue, 15 Jan 2013 17:22:03 +0000 (17:22 +0000)]
Optimize basic_ostream::write by having it call sputn instead of sputc.

llvm-svn: 172542

11 years ago[msan] Temporarily remove ICmpEQ tests.
Evgeniy Stepanov [Tue, 15 Jan 2013 17:12:04 +0000 (17:12 +0000)]
[msan] Temporarily remove ICmpEQ tests.

They are failing on the bots.

llvm-svn: 172540

11 years ago[msan] Fix handling of equality comparison of pointer vectors.
Evgeniy Stepanov [Tue, 15 Jan 2013 16:44:52 +0000 (16:44 +0000)]
[msan] Fix handling of equality comparison of pointer vectors.

Also improve test coveration of the handling of relational comparisons.

llvm-svn: 172539

11 years agoAllow vectors in CreatePointerCast.
Evgeniy Stepanov [Tue, 15 Jan 2013 16:43:00 +0000 (16:43 +0000)]
Allow vectors in CreatePointerCast.

Both underlying IR operations support vectors of pointers already.

llvm-svn: 172538

11 years agoDo not traverse the break-state when we know we cannot break anyway.
Manuel Klimek [Tue, 15 Jan 2013 16:41:02 +0000 (16:41 +0000)]
Do not traverse the break-state when we know we cannot break anyway.

This is an optimization that djasper spottet. For now, we do not format
anything after the first token that belongs to such an implicit string
literal. All our state is not made for handling that anyway, so we'll
revisit this if we find a problem.

llvm-svn: 172537

11 years agoFix formatting of preprocessor directives (incluces, warnings & errors).
Manuel Klimek [Tue, 15 Jan 2013 15:50:27 +0000 (15:50 +0000)]
Fix formatting of preprocessor directives (incluces, warnings & errors).

Treat tokens inside <> for includes and everything from the second token
of a warning / error on as an implicit string literal, e.g. do not
change its whitespace at all.

Now correctly formats:
 #include < path with space >
 #error Leave     all         white!!!!! space* alone!

Note that for #error and #warning we still format the space up to the
first token of the text, so:
   #  error   Text
will become
 #error Text

llvm-svn: 172536

11 years agoFix operand type conditions in one of ICmpInst constructors.
Evgeniy Stepanov [Tue, 15 Jan 2013 15:30:33 +0000 (15:30 +0000)]
Fix operand type conditions in one of ICmpInst constructors.

It was out of sync with the conditions in the other two constructors.

llvm-svn: 172535

11 years agoPattern-matched variables in post-inc-icmpzero.ll
Renato Golin [Tue, 15 Jan 2013 15:22:45 +0000 (15:22 +0000)]
Pattern-matched variables in post-inc-icmpzero.ll

Test was failing for clang-native-arm-cortex-a9 build-bot configuration.
The reason for the failure was the test was using hardcoded names.
The attached patch fixes this failure by replacing the hard-coded variables
names with pattern-matched variable names.

Patch by Manish Verma, ARM

llvm-svn: 172534

11 years agoImprove operator kind detection in presence of comments.
Daniel Jasper [Tue, 15 Jan 2013 14:27:39 +0000 (14:27 +0000)]
Improve operator kind detection in presence of comments.

We used to incorrectly identify some operators (*, &, +, -, etc.) if
there were comments around them.

Example:
Before: int a = /**/ - 1;
After:  int a = /**/ -1;

llvm-svn: 172533

11 years ago[asan] enable asan_allocator2 by default on Linux. Will enable it on other platforms...
Kostya Serebryany [Tue, 15 Jan 2013 13:57:39 +0000 (13:57 +0000)]
[asan] enable asan_allocator2 by default on Linux. Will enable it on other platforms and remove the old one later, after additional testing. The new allocator is much faster and uses less memory

llvm-svn: 172531

11 years agoFixes various bugs around the keywords class, struct and union.
Manuel Klimek [Tue, 15 Jan 2013 13:38:33 +0000 (13:38 +0000)]
Fixes various bugs around the keywords class, struct and union.

This switches to parsing record definitions only if we can clearly
identify them. We're specifically allowing common patterns for
visibility control through macros and attributes, but we cannot
currently fix all instances. This fixes all known bugs we have though.

Before:
static class A f() {
  return g();
} int x;

After:
static class A f() {
  return g();
}
int x;

llvm-svn: 172530

11 years agoasan: fix standalone malloc implementation
Dmitry Vyukov [Tue, 15 Jan 2013 12:57:02 +0000 (12:57 +0000)]
asan: fix standalone malloc implementation

llvm-svn: 172529

11 years agoResolved merge error with r172323 (llvm::X -> X)
Alexander Kornienko [Tue, 15 Jan 2013 12:20:21 +0000 (12:20 +0000)]
Resolved merge error with r172323 (llvm::X -> X)

llvm-svn: 172528

11 years agoasan: fix the constant for new allocator cache
Dmitry Vyukov [Tue, 15 Jan 2013 10:45:18 +0000 (10:45 +0000)]
asan: fix the constant for new allocator cache

llvm-svn: 172526

11 years agoUpdate CODE_OWNERS.TXT.
Michael J. Spencer [Tue, 15 Jan 2013 09:37:45 +0000 (09:37 +0000)]
Update CODE_OWNERS.TXT.

llvm-svn: 172525

11 years ago[sanitizer] hide PR_SET_NAME under an ifdef (for older kernels)
Kostya Serebryany [Tue, 15 Jan 2013 09:03:23 +0000 (09:03 +0000)]
[sanitizer] hide PR_SET_NAME under an ifdef (for older kernels)

llvm-svn: 172523

11 years agoasan: correct non-temporal prefetch for memory allocator
Dmitry Vyukov [Tue, 15 Jan 2013 09:03:20 +0000 (09:03 +0000)]
asan: correct non-temporal prefetch for memory allocator

llvm-svn: 172522

11 years agoasan: faster thead-local cache for memory allocator
Dmitry Vyukov [Tue, 15 Jan 2013 09:02:20 +0000 (09:02 +0000)]
asan: faster thead-local cache for memory allocator

llvm-svn: 172521

11 years agoasan: fix lint warnings
Dmitry Vyukov [Tue, 15 Jan 2013 08:51:10 +0000 (08:51 +0000)]
asan: fix lint warnings

llvm-svn: 172520