platform/upstream/llvm.git
11 years agoAdd comments.
Bill Wendling [Mon, 15 Oct 2012 19:58:25 +0000 (19:58 +0000)]
Add comments.

llvm-svn: 165958

11 years ago[ms-inline asm] Rework the front-end to use the API introduced in r165946.
Chad Rosier [Mon, 15 Oct 2012 19:56:10 +0000 (19:56 +0000)]
[ms-inline asm]  Rework the front-end to use the API introduced in r165946.

-The front-end now builds a single assembly string and feeds it to the
 AsmParser.  The front-end iterates on a per statement basis by calling the
 ParseStatement() function.  Please note, the calling of ParseStatement() and
 and any notion of MCAsmParsedOperands will be sunk into the MC layer in the
 near future.  I plan to expose more basic APIs such as getClobbers, etc.

-The enumeration of the AsmString expressions have been reworked to use SMLocs
 rather than assembly Pieces, which were being parsed in the front-end.

-The test case, t8(), was modified due to r129223.  I'll have to find a way to
 work around things such as these.

Sorry for the large commit, but breaking this in multiple smaller commits proved
too irritating.

llvm-svn: 165957

11 years agoAdd a cpu to try to fix the atom builder.
Rafael Espindola [Mon, 15 Oct 2012 19:25:43 +0000 (19:25 +0000)]
Add a cpu to try to fix the atom builder.

llvm-svn: 165956

11 years ago[ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instru...
Chad Rosier [Mon, 15 Oct 2012 19:08:18 +0000 (19:08 +0000)]
[ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instruction.

llvm-svn: 165955

11 years agoAdd testcase for pr14088.
Rafael Espindola [Mon, 15 Oct 2012 19:00:10 +0000 (19:00 +0000)]
Add testcase for pr14088.

llvm-svn: 165954

11 years agostructured document comment: patch to provide comment for overriding function
Fariborz Jahanian [Mon, 15 Oct 2012 18:58:50 +0000 (18:58 +0000)]
structured document comment: patch to provide comment for overriding function
template when comment is comming from overridden declaration.
// rdar://12378793

llvm-svn: 165953

11 years agomisched tests: add a triple to speculatively fix windows builders.
Andrew Trick [Mon, 15 Oct 2012 18:21:08 +0000 (18:21 +0000)]
misched tests: add a triple to speculatively fix windows builders.

llvm-svn: 165952

11 years agoMake sure we iterate over newly created instructions. Fixes pr13625. Testcase to
Rafael Espindola [Mon, 15 Oct 2012 18:21:07 +0000 (18:21 +0000)]
Make sure we iterate over newly created instructions. Fixes pr13625. Testcase to
follow in one sec.

llvm-svn: 165951

11 years agomisched: ILP scheduler for experimental heuristics.
Andrew Trick [Mon, 15 Oct 2012 18:02:27 +0000 (18:02 +0000)]
misched: ILP scheduler for experimental heuristics.

llvm-svn: 165950

11 years agoAdd an entry in CREDITS.TXT
Argyrios Kyrtzidis [Mon, 15 Oct 2012 17:34:53 +0000 (17:34 +0000)]
Add an entry in CREDITS.TXT

llvm-svn: 165949

11 years ago[ms-inline asm] Update the end loc for ParseIntelMemOperand.
Chad Rosier [Mon, 15 Oct 2012 17:26:38 +0000 (17:26 +0000)]
[ms-inline asm] Update the end loc for ParseIntelMemOperand.

llvm-svn: 165947

11 years ago[ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style
Chad Rosier [Mon, 15 Oct 2012 17:19:13 +0000 (17:19 +0000)]
[ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style
inline assembly.  For the time being, these will be called directly by clang.
However, in the near future I expect these to be sunk back into the MC layer
and more basic APIs (e.g., getClobbers(), getConstraints(), etc.) will be called
by clang.

llvm-svn: 165946

11 years ago[ms-inline asm] Use incoming argument rather than hard coding to false.
Chad Rosier [Mon, 15 Oct 2012 16:50:34 +0000 (16:50 +0000)]
[ms-inline asm] Use incoming argument rather than hard coding to false.

llvm-svn: 165945

11 years agoFix a typo in bitcode docs, from 165814.
Jan Wen Voung [Mon, 15 Oct 2012 16:47:58 +0000 (16:47 +0000)]
Fix a typo in bitcode docs, from 165814.

llvm-svn: 165944

11 years agoTeach TargetInfo to hold on to the TargetOptions with which it was
Douglas Gregor [Mon, 15 Oct 2012 16:45:32 +0000 (16:45 +0000)]
Teach TargetInfo to hold on to the TargetOptions with which it was
created.

llvm-svn: 165943

11 years agoResubmit the changes to llvm core to update the functions to support different pointe...
Micah Villmow [Mon, 15 Oct 2012 16:24:29 +0000 (16:24 +0000)]
Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis.

llvm-svn: 165941

11 years agoPowerPC: add EmitTCEntry class for TOC creation
Adhemerval Zanella [Mon, 15 Oct 2012 15:43:14 +0000 (15:43 +0000)]
PowerPC: add EmitTCEntry class for TOC creation

This patch replaces the EmitRawText by a EmitTCEntry class (specialized for
each Streamer) in PowerPC64 TOC entry creation.

llvm-svn: 165940

11 years agoImplement internal_memmove.
Alexander Potapenko [Mon, 15 Oct 2012 15:34:41 +0000 (15:34 +0000)]
Implement internal_memmove.
Use internal_memmove() and internal_memcpy() in the memcpy() and memmove() wrappers
when building the dynamic runtime (OS X only), to work around a bug in resolver functions wrapping.
See also http://code.google.com/p/address-sanitizer/issues/detail?id=116

llvm-svn: 165939

11 years ago[asan] fix a test
Kostya Serebryany [Mon, 15 Oct 2012 14:30:30 +0000 (14:30 +0000)]
[asan] fix a test

llvm-svn: 165938

11 years ago[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. clang part...
Kostya Serebryany [Mon, 15 Oct 2012 14:22:56 +0000 (14:22 +0000)]
[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. clang part: for FunctionPass we need to run asan at a different point, otherwise it will run before inlining

llvm-svn: 165937

11 years ago[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. This will...
Kostya Serebryany [Mon, 15 Oct 2012 14:20:06 +0000 (14:20 +0000)]
[asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. This will simplify chaining other FunctionPasses with asan. Also some minor cleanup

llvm-svn: 165936

11 years ago[asan] fix more tests
Kostya Serebryany [Mon, 15 Oct 2012 13:30:38 +0000 (13:30 +0000)]
[asan] fix more tests

llvm-svn: 165934

11 years agoOnly report first error when no compilation database is found.
Daniel Jasper [Mon, 15 Oct 2012 13:12:24 +0000 (13:12 +0000)]
Only report first error when no compilation database is found.

Review: http://llvm-reviews.chandlerc.com/D62
llvm-svn: 165933

11 years ago[asan] change the asan output slightly to avoid user confusion: a) add ':' after...
Kostya Serebryany [Mon, 15 Oct 2012 13:04:58 +0000 (13:04 +0000)]
[asan] change the asan output slightly to avoid user confusion: a) add ':' after 'AddressSanitizer' and b) changed 'crashed' to 'SEGV'

llvm-svn: 165932

11 years agoUpdate the memcpy rewriting to fully support widened int rewriting. This
Chandler Carruth [Mon, 15 Oct 2012 10:24:43 +0000 (10:24 +0000)]
Update the memcpy rewriting to fully support widened int rewriting. This
includes extracting ints for copying elsewhere and inserting ints when
copying into the alloca. This should fix the CanSROA assertion coming
out of Clang's regression test suite.

llvm-svn: 165931

11 years agoFollow-up fix to r165928: handle memset rewriting for widened integers,
Chandler Carruth [Mon, 15 Oct 2012 10:24:40 +0000 (10:24 +0000)]
Follow-up fix to r165928: handle memset rewriting for widened integers,
and generally clean up the memset handling. It had rotted a bit as the
other rewriting logic got polished more.

llvm-svn: 165930

11 years agoFixed PR13938: the ARM backend was crashing because it couldn't select a VDUPLANE...
Silviu Baranga [Mon, 15 Oct 2012 09:41:32 +0000 (09:41 +0000)]
Fixed PR13938: the ARM backend was crashing because it couldn't select a VDUPLANE node with the vector input size different from the output size. This was bacause the BUILD_VECTOR lowering code didn't check that the size of the input vector was correct for using VDUPLANE.

llvm-svn: 165929

11 years agoFirst major step toward addressing PR14059. This teaches SROA to handle
Chandler Carruth [Mon, 15 Oct 2012 08:40:30 +0000 (08:40 +0000)]
First major step toward addressing PR14059. This teaches SROA to handle
cases where we have partial integer loads and stores to an otherwise
promotable alloca to widen[1] those loads and stores to cover the entire
alloca and bitcast them into the appropriate type such that promotion
can proceed.

These partial loads and stores stem from an annoying confluence of ARM's
calling convention and ABI lowering and the FCA pre-splitting which
takes place in SROA. Clang lowers a { double, double } in-register
function argument as a [4 x i32] function argument to ensure it is
placed into integer 32-bit registers (a really unnerving implicit
contract between Clang and the ARM backend I would add). This results in
a FCA load of [4 x i32]* from the { double, double } alloca, and SROA
decomposes this into a sequence of i32 loads and stores. Inlining
proceeds, code gets folded, but at the end of the day, we still have i32
stores to the low and high halves of a double alloca. Widening these to
be i64 operations, and bitcasting them to double prior to loading or
storing allows promotion to proceed for these allocas.

I looked quite a bit changing the IR which Clang produces for this case
to be more friendly, but small changes seem unlikely to help. I think
the best representation we could use currently would be to pass 4 i32
arguments thereby avoiding any FCAs, but that would still require this
fix. It seems like it might eventually be nice to somehow encode the ABI
register selection choices outside of the parameter type system so that
the parameter can be a { double, double }, but the CC register
annotations indicate that this should be passed via 4 integer registers.

This patch does not address the second problem in PR14059, which is the
reverse: when a struct alloca is loaded as a *larger* single integer.

This patch also does not address some of the code quality issues with
the FCA-splitting. Those don't actually impede any optimizations really,
but they're on my list to clean up.

[1]: Pedantic footnote: for those concerned about memory model issues
here, this is safe. For the alloca to be promotable, it cannot escape or
have any use of its address that could allow these loads or stores to be
racing. Thus, widening is always safe.

llvm-svn: 165928

11 years agoHoist the canConvertValue predicate and the convertValue transform out
Chandler Carruth [Mon, 15 Oct 2012 08:40:22 +0000 (08:40 +0000)]
Hoist the canConvertValue predicate and the convertValue transform out
into static helper functions. They're really quite generic and are going
to be needed elsewhere shortly.

llvm-svn: 165927

11 years agoUse enum values instead of magic numbers for indexing into the attribute list.
Bill Wendling [Mon, 15 Oct 2012 07:31:59 +0000 (07:31 +0000)]
Use enum values instead of magic numbers for indexing into the attribute list.

llvm-svn: 165925

11 years agoAdd an enum for the return and function indexes into the AttrListPtr object. This...
Bill Wendling [Mon, 15 Oct 2012 07:29:08 +0000 (07:29 +0000)]
Add an enum for the return and function indexes into the AttrListPtr object. This gets rid of some magic numbers.

llvm-svn: 165924

11 years agoUse a ::get method to create the attribute from Attributes::AttrVals instead of a...
Bill Wendling [Mon, 15 Oct 2012 06:53:28 +0000 (06:53 +0000)]
Use a ::get method to create the attribute from Attributes::AttrVals instead of a constructor.

llvm-svn: 165923

11 years agoSupply a default 'operator=' method.
Bill Wendling [Mon, 15 Oct 2012 06:34:18 +0000 (06:34 +0000)]
Supply a default 'operator=' method.

llvm-svn: 165922

11 years agoIntroduce the notion of excluded headers into the module map
Douglas Gregor [Mon, 15 Oct 2012 06:28:11 +0000 (06:28 +0000)]
Introduce the notion of excluded headers into the module map
description. Previously, one could emulate this behavior by placing
the header in an always-unavailable submodule, but Argyrios guilted me
into expressing this idea properly.

llvm-svn: 165921

11 years agoMove the AttributesImpl header file into the VMCore directory so that it can be opaque.
Bill Wendling [Mon, 15 Oct 2012 05:40:12 +0000 (05:40 +0000)]
Move the AttributesImpl header file into the VMCore directory so that it can be opaque.

llvm-svn: 165920

11 years agoAttributes Rewrite
Bill Wendling [Mon, 15 Oct 2012 04:47:45 +0000 (04:47 +0000)]
Attributes Rewrite

Convert the uses of the Attributes class over to the new format. The
Attributes::get method call now takes an LLVM context so that the attributes
object can be uniquified and stored.

llvm-svn: 165918

11 years agoAttributes Rewrite
Bill Wendling [Mon, 15 Oct 2012 04:46:55 +0000 (04:46 +0000)]
Attributes Rewrite

Convert the internal representation of the Attributes class into a pointer to an
opaque object that's uniqued by and stored in the LLVMContext object. The
Attributes class then becomes a thin wrapper around this opaque
object. Eventually, the internal representation will be expanded to include
attributes that represent code generation options, etc.

llvm-svn: 165917

11 years agoinstcombine: Migrate strcmp and strncmp optimizations
Meador Inge [Mon, 15 Oct 2012 03:47:37 +0000 (03:47 +0000)]
instcombine: Migrate strcmp and strncmp optimizations

This patch migrates the strcmp and strncmp optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

llvm-svn: 165915

11 years agoAt -O0, emit an @llvm.trap() call at the end of a value-returning function which
Richard Smith [Mon, 15 Oct 2012 00:23:07 +0000 (00:23 +0000)]
At -O0, emit an @llvm.trap() call at the end of a value-returning function which
fails to return a value, to make debugging this issue easier.

llvm-svn: 165914

11 years agoProvide a slightly more helpful diagnostic if -fcatch-undefined-behavior finds
Richard Smith [Sun, 14 Oct 2012 23:53:37 +0000 (23:53 +0000)]
Provide a slightly more helpful diagnostic if -fcatch-undefined-behavior finds
a problem with __int128 arithmetic but the runtime was not built with __int128
support.

llvm-svn: 165913

11 years agoUse a better test for __int128 support, which works on old GCC versions.
Richard Smith [Sun, 14 Oct 2012 23:28:55 +0000 (23:28 +0000)]
Use a better test for __int128 support, which works on old GCC versions.

llvm-svn: 165912

11 years agoMake sure temporary files are deleted when recovering from a crash when compiling...
Benjamin Kramer [Sun, 14 Oct 2012 19:50:53 +0000 (19:50 +0000)]
Make sure temporary files are deleted when recovering from a crash when compiling modules.

llvm-svn: 165911

11 years agoDelete temporary output files when an error occurs during PCH reading.
Benjamin Kramer [Sun, 14 Oct 2012 19:21:21 +0000 (19:21 +0000)]
Delete temporary output files when an error occurs during PCH reading.

This reduces the spam make test leaves behind in /tmp. The assert isn't
particularly useful because it's not run with -disable-free (the default when
using the clang driver) but should cover all -cc1 tests.

llvm-svn: 165910

11 years agoUpdate CMake build.
Benjamin Kramer [Sun, 14 Oct 2012 16:06:09 +0000 (16:06 +0000)]
Update CMake build.

llvm-svn: 165908

11 years agoFix a typo that made ImmutableMap::getMaxElement() useless.
Benjamin Kramer [Sun, 14 Oct 2012 15:56:39 +0000 (15:56 +0000)]
Fix a typo that made ImmutableMap::getMaxElement() useless.

Add a basic unit test for ImmutableMap. Found by inspection.

llvm-svn: 165907

11 years agoSimplify code. No functionality change.
Benjamin Kramer [Sun, 14 Oct 2012 11:50:50 +0000 (11:50 +0000)]
Simplify code. No functionality change.

llvm-svn: 165905

11 years agoSimplify code. No functionality change.
Benjamin Kramer [Sun, 14 Oct 2012 11:15:42 +0000 (11:15 +0000)]
Simplify code. No functionality change.

llvm-svn: 165904

11 years agoUnquadratize SetVector removal loops in DSE.
Benjamin Kramer [Sun, 14 Oct 2012 10:21:31 +0000 (10:21 +0000)]
Unquadratize SetVector removal loops in DSE.

Erasing from the beginning or middle of the vector is expensive, remove_if can
do it in linear time even though it's a bit ugly without lambdas.

No functionality change.

llvm-svn: 165903

11 years agoRemove dead methods.
Bill Wendling [Sun, 14 Oct 2012 09:21:44 +0000 (09:21 +0000)]
Remove dead methods.

llvm-svn: 165902

11 years agoRemove operator cast method in favor of querying with the correct method.
Bill Wendling [Sun, 14 Oct 2012 08:54:39 +0000 (08:54 +0000)]
Remove operator cast method in favor of querying with the correct method.

llvm-svn: 165900

11 years agoRemove operator cast method in favor of querying with the correct method.
Bill Wendling [Sun, 14 Oct 2012 08:54:26 +0000 (08:54 +0000)]
Remove operator cast method in favor of querying with the correct method.

llvm-svn: 165899

11 years agoFix use after free when deleting attributes in a chained folding set.
Benjamin Kramer [Sun, 14 Oct 2012 08:48:40 +0000 (08:48 +0000)]
Fix use after free when deleting attributes in a chained folding set.

Can't follow the intrusive linked list when the element is gone.

llvm-svn: 165898

11 years agoDon't use the new syntax just yet.
Bill Wendling [Sun, 14 Oct 2012 08:25:35 +0000 (08:25 +0000)]
Don't use the new syntax just yet.

llvm-svn: 165897

11 years agoRemove the bitwise AND operators from the Attributes class. Replace it with the equiv...
Bill Wendling [Sun, 14 Oct 2012 07:52:48 +0000 (07:52 +0000)]
Remove the bitwise AND operators from the Attributes class. Replace it with the equivalent from the builder class.

llvm-svn: 165896

11 years agoRemove the bitwise assignment OR operator from the Attributes class. Replace it with...
Bill Wendling [Sun, 14 Oct 2012 07:35:59 +0000 (07:35 +0000)]
Remove the bitwise assignment OR operator from the Attributes class. Replace it with the equivalent from the builder class.

llvm-svn: 165895

11 years agoRemove the bitwise OR operator from the Attributes class. Replace it with the equival...
Bill Wendling [Sun, 14 Oct 2012 07:17:34 +0000 (07:17 +0000)]
Remove the bitwise OR operator from the Attributes class. Replace it with the equivalent from the builder class.

llvm-svn: 165894

11 years agoRemove the bitwise XOR operator from the Attributes class. Replace it with the equiva...
Bill Wendling [Sun, 14 Oct 2012 06:56:13 +0000 (06:56 +0000)]
Remove the bitwise XOR operator from the Attributes class. Replace it with the equivalent from the builder class.

llvm-svn: 165893

11 years agoRemove the bitwise NOT operator from the Attributes class. Replace it with the equiva...
Bill Wendling [Sun, 14 Oct 2012 06:39:53 +0000 (06:39 +0000)]
Remove the bitwise NOT operator from the Attributes class. Replace it with the equivalent from the builder class.

llvm-svn: 165892

11 years agoDecode the LLVM attributes from bitcode using the attributes builder.
Bill Wendling [Sun, 14 Oct 2012 04:10:01 +0000 (04:10 +0000)]
Decode the LLVM attributes from bitcode using the attributes builder.

llvm-svn: 165891

11 years agoUse builder to create alignment attributes. Remove dead function.
Bill Wendling [Sun, 14 Oct 2012 03:58:29 +0000 (03:58 +0000)]
Use builder to create alignment attributes. Remove dead function.

llvm-svn: 165890

11 years agoRemove dead method.
Bill Wendling [Sun, 14 Oct 2012 03:28:43 +0000 (03:28 +0000)]
Remove dead method.

llvm-svn: 165889

11 years agoUse the Builder to create the stack alignment attribute.
Bill Wendling [Sun, 14 Oct 2012 03:28:14 +0000 (03:28 +0000)]
Use the Builder to create the stack alignment attribute.

llvm-svn: 165888

11 years agoDon't pass in an Attributes object to something that expects an integral value.
Bill Wendling [Sun, 14 Oct 2012 03:27:15 +0000 (03:27 +0000)]
Don't pass in an Attributes object to something that expects an integral value.

llvm-svn: 165887

11 years ago"Implement" codegen support for __noop().
Nico Weber [Sat, 13 Oct 2012 22:30:41 +0000 (22:30 +0000)]
"Implement" codegen support for __noop().

Eli discovered that __noop's sema behavior also needs some love. I filed
PR14081 for that and intend to improve it.

llvm-svn: 165886

11 years agoSimplify. Suggestion by Sean Silva.
Nico Weber [Sat, 13 Oct 2012 21:56:05 +0000 (21:56 +0000)]
Simplify. Suggestion by Sean Silva.

llvm-svn: 165885

11 years agoUse traits_type::to_int_type in basic_streambuf<_CharT, _Traits>::xsputn when calling...
Howard Hinnant [Sat, 13 Oct 2012 19:31:51 +0000 (19:31 +0000)]
Use traits_type::to_int_type in basic_streambuf<_CharT, _Traits>::xsputn when calling overflow to correctly handle negative signed character types.  This fixes llvm.org/bugs/show_bug.cgi?id=14074.

llvm-svn: 165884

11 years agoMake the type_info for __shim_type_info visible. This should address some failing...
Howard Hinnant [Sat, 13 Oct 2012 18:45:59 +0000 (18:45 +0000)]
Make the type_info for __shim_type_info visible.  This should address some failing dynamic_casts that a few applications are doing on the type_info hierarchy.

llvm-svn: 165883

11 years agoDimitry Andric: FreeBSD only: Add the C11 aligned_alloc to <cstdlib> and adjust...
Howard Hinnant [Sat, 13 Oct 2012 18:03:53 +0000 (18:03 +0000)]
Dimitry Andric:  FreeBSD only:  Add the C11 aligned_alloc to <cstdlib> and adjust the inclusion of quick_exit.

llvm-svn: 165882

11 years agoRemove unused private field.
Benjamin Kramer [Sat, 13 Oct 2012 18:03:34 +0000 (18:03 +0000)]
Remove unused private field.

llvm-svn: 165881

11 years agoX86: Depending on the local semantics of .align this test can also emit a nopl instea...
Benjamin Kramer [Sat, 13 Oct 2012 17:38:00 +0000 (17:38 +0000)]
X86: Depending on the local semantics of .align this test can also emit a nopl instead of nopw.

llvm-svn: 165880

11 years agoDocumentation: Lexicon.rst: add "BB Vectorization" and "TBAA".
Dmitri Gribenko [Sat, 13 Oct 2012 17:34:49 +0000 (17:34 +0000)]
Documentation: Lexicon.rst: add "BB Vectorization" and "TBAA".

llvm-svn: 165879

11 years agoX86: Disable long nops for all cpus prior to pentiumpro/i686.
Benjamin Kramer [Sat, 13 Oct 2012 17:28:35 +0000 (17:28 +0000)]
X86: Disable long nops for all cpus prior to pentiumpro/i686.

llvm-svn: 165878

11 years agoDrop <def,dead> flags when merging into an unused lane.
Jakob Stoklund Olesen [Sat, 13 Oct 2012 17:26:47 +0000 (17:26 +0000)]
Drop <def,dead> flags when merging into an unused lane.

The new coalescer can merge a dead def into an unused lane of an
otherwise live vector register.

Clear the <dead> flag when that happens since the flag refers to the
full virtual register which is still live after the partial dead def.

This fixes PR14079.

llvm-svn: 165877

11 years agoMention that the code signing process also applies to Mountain Lion
Enrico Granata [Sat, 13 Oct 2012 17:06:33 +0000 (17:06 +0000)]
Mention that the code signing process also applies to Mountain Lion

llvm-svn: 165876

11 years agoinstcombine: Migrate strchr and strrchr optimizations
Meador Inge [Sat, 13 Oct 2012 16:45:37 +0000 (16:45 +0000)]
instcombine: Migrate strchr and strrchr optimizations

This patch migrates the strchr and strrchr optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

llvm-svn: 165875

11 years agoinstcombine: Migrate strcat and strncat optimizations
Meador Inge [Sat, 13 Oct 2012 16:45:32 +0000 (16:45 +0000)]
instcombine: Migrate strcat and strncat optimizations

This patch migrates the strcat and strncat optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.

llvm-svn: 165874

11 years agoImplement new LibCallSimplifier class
Meador Inge [Sat, 13 Oct 2012 16:45:24 +0000 (16:45 +0000)]
Implement new LibCallSimplifier class

This patch implements the new LibCallSimplifier class as outlined in [1].
In addition to providing the new base library simplification infrastructure,
all the fortified library call simplifications were moved over to the new
infrastructure.  The rest of the library simplification optimizations will
be moved over with follow up patches.

NOTE: The original fortified library call simplifier located in the
SimplifyFortifiedLibCalls class was not removed because it is still
used by CodeGenPrepare.  This class will eventually go away too.

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052283.html

llvm-svn: 165873

11 years agoAllow for loops in LiveIntervals::pruneValue().
Jakob Stoklund Olesen [Sat, 13 Oct 2012 16:15:31 +0000 (16:15 +0000)]
Allow for loops in LiveIntervals::pruneValue().

It is possible that the live range of the value being pruned loops back
into the kill MBB where the search started. When that happens, make sure
that the beginning of KillMBB is also pruned.

Instead of starting a DFS at KillMBB and skipping the root of the
search, start a DFS at each KillMBB successor, and allow the search to
loop back to KillMBB.

This fixes PR14078.

llvm-svn: 165872

11 years agoX86: Fix accidentally swapped operands.
Benjamin Kramer [Sat, 13 Oct 2012 12:50:19 +0000 (12:50 +0000)]
X86: Fix accidentally swapped operands.

llvm-svn: 165871

11 years agoTeach SROA to cope with wrapper aggregates. These show up a lot in ABI
Chandler Carruth [Sat, 13 Oct 2012 10:49:33 +0000 (10:49 +0000)]
Teach SROA to cope with wrapper aggregates. These show up a lot in ABI
type coercion code, especially when targetting ARM. Things like [1
x i32] instead of i32 are very common there.

The goal of this logic is to ensure that when we are picking an alloca
type, we look through such wrapper aggregates and across any zero-length
aggregate elements to find the simplest type possible to form a type
partition.

This logic should (generally speaking) rarely fire. It only ends up
kicking in when an alloca is accessed using two different types (for
instance, i32 and float), and the underlying alloca type has wrapper
aggregates around it. I noticed a significant amount of this occurring
looking at stepanov_abstraction generated code for arm, and suspect it
happens elsewhere as well.

Note that this doesn't yet address truly heinous IR productions such as
PR14059 is concerning. Those result in mismatched *sizes* of types in
addition to mismatched access and alloca types.

llvm-svn: 165870

11 years agoSpeculatively harden the conversion logic. I have no idea if this will
Chandler Carruth [Sat, 13 Oct 2012 10:49:30 +0000 (10:49 +0000)]
Speculatively harden the conversion logic. I have no idea if this will
help the dragonegg builders, and no test case at this point, but this
was one dimly plausible case I spotted by inspection. Hopefully will get
a testcase from those bots soon-ish, and will tidy this up with proper
testing.

llvm-svn: 165869

11 years agoX86: Promote i8 cmov when both operands are coming from truncates of the same width.
Benjamin Kramer [Sat, 13 Oct 2012 10:39:49 +0000 (10:39 +0000)]
X86: Promote i8 cmov when both operands are coming from truncates of the same width.

X86 doesn't have i8 cmovs so isel would emit a branch. Emitting branches at this
level is often not a good idea because it's too late for many optimizations to
kick in. This solution doesn't add any extensions (truncs are free) and tries
to avoid introducing partial register stalls by filtering direct copyfromregs.

I'm seeing a ~10% speedup on reading a random .png file with libpng15 via
graphicsmagick on x86_64/westmere, but YMMV depending on the microarchitecture.

llvm-svn: 165868

11 years agoSilence a warning in -assert builds.
Chandler Carruth [Sat, 13 Oct 2012 05:09:27 +0000 (05:09 +0000)]
Silence a warning in -assert builds.

llvm-svn: 165867

11 years ago[analyzer] Remove the "direct bindings only" Environment lookup.
Jordan Rose [Sat, 13 Oct 2012 05:05:20 +0000 (05:05 +0000)]
[analyzer] Remove the "direct bindings only" Environment lookup.

This was only used by OSAtomicChecker and makes it more
difficult to update values for expressions that the environment
may look through instead (it's not the same as IgnoreParens).
With this gone, we can have bindExpr bind to the inner
expression that getSVal will find.

Groundwork for <rdar://problem/12137950>

llvm-svn: 165866

11 years ago[analyzer] Remove unneeded 'inlineCall' checker callback.
Jordan Rose [Sat, 13 Oct 2012 05:05:13 +0000 (05:05 +0000)]
[analyzer] Remove unneeded 'inlineCall' checker callback.

I believe the removed assert in CheckerManager says it best:

InlineCall is a special hacky callback to allow intrusive
evaluation of the call (which simulates inlining). It is
currently only used by OSAtomicChecker and should go away
at some point.

OSAtomicChecker has gone away; inlineCall can now go away as well!

llvm-svn: 165865

11 years agoClean up how we rewrite loads and stores to the whole alloca. When these
Chandler Carruth [Sat, 13 Oct 2012 02:41:05 +0000 (02:41 +0000)]
Clean up how we rewrite loads and stores to the whole alloca. When these
are single value types, the load and store should be directly based upon
the alloca and then bitcasting can fix the type as needed afterward.
This might in theory improve some of the IR coming out of SROA, but
I don't expect big changes yet and don't have any test cases on hand.
This is really just a cleanup/refactoring patch. The next patch will
cause this code path to be hit a lot more, actually get SROA to promote
more allocas and include several more test cases.

llvm-svn: 165864

11 years agoFix the bootstrap of CompilerRT with host compilers that don't support
Chandler Carruth [Sat, 13 Oct 2012 02:30:10 +0000 (02:30 +0000)]
Fix the bootstrap of CompilerRT with host compilers that don't support
emulating 128-bit arithmetic on 32-bit x86 targets. This should get the
bootstrap back for GCC 4.6 at least.

Suggestions on better ways to do the detection here are welcome...

llvm-svn: 165863

11 years agoMake sure we always use lldb::tid_t for thread IDs so we don't truncate a 64 bit...
Greg Clayton [Sat, 13 Oct 2012 02:11:55 +0000 (02:11 +0000)]
Make sure we always use lldb::tid_t for thread IDs so we don't truncate a 64 bit thread ID.

llvm-svn: 165862

11 years ago<rdar://problem/12491387>
Greg Clayton [Sat, 13 Oct 2012 02:07:45 +0000 (02:07 +0000)]
<rdar://problem/12491387>

I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override:

virtual CommandObject *
GetPluginCommandObject();

This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented!

llvm-svn: 165861

11 years agoDon't neglect to "return *this".
Argyrios Kyrtzidis [Sat, 13 Oct 2012 02:03:45 +0000 (02:03 +0000)]
Don't neglect to "return *this".

llvm-svn: 165860

11 years agoUpdate for r165858.
Chad Rosier [Sat, 13 Oct 2012 00:26:22 +0000 (00:26 +0000)]
Update for r165858.

llvm-svn: 165859

11 years ago[ms-inline asm] Remove the MatchInstruction() function. Previously, this was
Chad Rosier [Sat, 13 Oct 2012 00:26:04 +0000 (00:26 +0000)]
[ms-inline asm]  Remove the MatchInstruction() function.  Previously, this was
the interface between the front-end and the MC layer when parsing inline
assembly.  Unfortunately, this is too deep into the parsing stack. Specifically,
we're unable to handle target-independent assembly (i.e., assembly directives,
labels, etc.).  Note the MatchAndEmitInstruction() isn't the correct
abstraction either.  I'll be exposing target-independent hooks shortly, so this
is really just a cleanup.

llvm-svn: 165858

11 years ago<rdar://problem/12490588>
Greg Clayton [Sat, 13 Oct 2012 00:20:27 +0000 (00:20 +0000)]
<rdar://problem/12490588>

From SBType, we can now get a lldb::BasicType enumeration out of an existing type.

llvm-svn: 165857

11 years agoProvide an SSL context ref in case SLL is needed for communication.
Greg Clayton [Sat, 13 Oct 2012 00:18:18 +0000 (00:18 +0000)]
Provide an SSL context ref in case SLL is needed for communication.

llvm-svn: 165856

11 years agoCheck section type rather than assuming it's code when emitting sections while proces...
Andrew Kaylor [Fri, 12 Oct 2012 23:53:16 +0000 (23:53 +0000)]
Check section type rather than assuming it's code when emitting sections while processing relocations.

llvm-svn: 165854

11 years agoARM: tail-call inside a function where part of a byval argument is on caller's
Manman Ren [Fri, 12 Oct 2012 23:39:43 +0000 (23:39 +0000)]
ARM: tail-call inside a function where part of a byval argument is on caller's
local frame causes problem.

For example:
void f(StructToPass s) {
  g(&s, sizeof(s));
}
will cause problem with tail-call since part of s is passed via registers and
saved in f's local frame. When g tries to access s, part of s may be corrupted
since f's local frame is popped out before the tail-call.

The current fix is to disable tail-call if getVarArgsRegSaveSize is not 0 for
the caller. This is a conservative approach, if we can prove the address of
s or part of s is not taken and passed to g, it should be okay to perform
tail-call.

rdar://12442472

llvm-svn: 165853

11 years ago<rdar://problem/12490558>
Greg Clayton [Fri, 12 Oct 2012 23:32:11 +0000 (23:32 +0000)]
<rdar://problem/12490558>

SBProcess::SetSelectedThreadByID() had a "uint32_t tid" parameter which would truncate 64 bit thread IDs (lldb::tid_t is 64 bit).

llvm-svn: 165852

11 years ago[ms-inline asm] Remove a bunch of parsing code from the front-end.
Chad Rosier [Fri, 12 Oct 2012 23:32:10 +0000 (23:32 +0000)]
[ms-inline asm] Remove a bunch of parsing code from the front-end.

llvm-svn: 165851

11 years agoAdd TargetInfo for r600.
Eli Friedman [Fri, 12 Oct 2012 23:32:00 +0000 (23:32 +0000)]
Add TargetInfo for r600.

Patch by Tom Stellard.

llvm-svn: 165850

11 years agoMake -mms-bitfields behave consistently.
Eli Friedman [Fri, 12 Oct 2012 23:29:20 +0000 (23:29 +0000)]
Make -mms-bitfields behave consistently.

Patch by Jeremiah Zanin.

llvm-svn: 165849