Commit Graph

161884 Commits

Author SHA1 Message Date
Hao Liu 9e49704f59 Implement vreinterpret ACLE functions in Clang.
llvm-svn: 194954
2013-11-17 09:32:59 +00:00
Anton Yartsev 968c60a554 [analyzer] Better modeling of memcpy by the CStringChecker (PR16731).
New rules of invalidation/escape of the source buffer of memcpy: the source buffer contents is invalidated and escape while the source buffer region itself is neither invalidated, nor escape.
In the current modeling of memcpy the information about allocation state of regions, accessible through the source buffer, is not copied to the destination buffer and we can not track the allocation state of those regions anymore. So we invalidate/escape the source buffer indirect regions in anticipation of their being invalidated for real later. This eliminates false-positive leaks reported by the unix.Malloc and alpha.cplusplus.NewDeleteLeaks checkers for the cases like

char *f() {
  void *x = malloc(47);
  char *a;
  memcpy(&a, &x, sizeof a);
  return a;
}

llvm-svn: 194953
2013-11-17 09:18:48 +00:00
Hao Liu 90ee2f1fd7 Fix the problem that the arm_neon.h can't be used in a cpp file. Also fix a minor bug with poly64 name mangling.
llvm-svn: 194952
2013-11-17 09:14:46 +00:00
Richard Smith 3cde3d245a Tests for core issue 241-250.
llvm-svn: 194951
2013-11-17 06:39:43 +00:00
Michael Gottesman 4d078a3d6f [block-freq] Add BlockFrequency::scale that returns a remainder from the division and make the private scale in BlockFrequency more performant.
This change is the first in a series of changes improving LLVM's Block
Frequency propogation implementation to not lose probability mass in
branchy code when propogating block frequency information from a basic
block to its successors. This patch is a simple infrastructure
improvement that does not actually modify the block frequency
algorithm. The specific changes are:

1. Changes the division algorithm used when scaling block frequencies by
branch probabilities to a short division algorithm. This gives us the
remainder for free as well as provides a nice speed boost. When I
benched the old routine and the new routine on a Sandy Bridge iMac with
disabled turbo mode performing 8192 iterations on an array of length
32768, I saw ~600% increase in speed in mean/median performance.

2. Exposes a scale method that returns a remainder. This is important so
we can ensure that when we scale a block frequency by some branch
probability BP = N/D, the remainder from the division by D can be
retrieved and propagated to other children to ensure no probability mass
is lost (more to come on this).

llvm-svn: 194950
2013-11-17 03:25:24 +00:00
Tobias Grosser e5f00c8bd2 Fix 80 column violation
Found by clang-format.

llvm-svn: 194949
2013-11-17 03:18:32 +00:00
Tobias Grosser 54ee0ba74d IslCodegen: Support for run-time conditions
llvm-svn: 194948
2013-11-17 03:18:25 +00:00
Chandler Carruth a8df47603a [PM] Completely remove support for explicit 'require' methods on the
AnalysisManager. All this method did was assert something and we have
a perfectly good way to trigger that assert from the query path.

llvm-svn: 194947
2013-11-17 03:18:05 +00:00
Richard Smith 7101fd0e56 Tests for core issues 224-240.
llvm-svn: 194946
2013-11-17 02:50:30 +00:00
Matt Arsenault 64283bd99c Use more getZExtOrTruncs
llvm-svn: 194945
2013-11-17 02:31:26 +00:00
Matt Arsenault 873bb3ea86 Use getZExtOrTrunc instead of repeating the same logic.
llvm-svn: 194944
2013-11-17 02:24:21 +00:00
Hal Finkel 66cd3f1ba3 Add the cold attribute to error-reporting call sites
Generally speaking, control flow paths with error reporting calls are cold.
So far, error reporting calls are calls to perror and calls to fprintf,
fwrite, etc. with stderr as the stream. This can be extended in the future.

The primary motivation is to improve block placement (the cold attribute
affects the static branch prediction heuristics).

llvm-svn: 194943
2013-11-17 02:06:35 +00:00
Andrew Trick 10d5be4e6e Added a size field to the stack map record to handle subregister spills.
Implementing this on bigendian platforms could get strange. I added a
target hook, getStackSlotRange, per Jakob's recommendation to make
this as explicit as possible.

llvm-svn: 194942
2013-11-17 01:36:23 +00:00
Hal Finkel 67107ea1af Fix ndebug-build unused variable in loop rerolling
llvm-svn: 194941
2013-11-17 01:21:54 +00:00
Matt Arsenault 36f5eb5949 Use right address space pointer size
llvm-svn: 194940
2013-11-17 00:06:39 +00:00
Hal Finkel bf45efde2d Add a loop rerolling pass
This adds a loop rerolling pass: the opposite of (partial) loop unrolling. The
transformation aims to take loops like this:

for (int i = 0; i < 3200; i += 5) {
  a[i]     += alpha * b[i];
  a[i + 1] += alpha * b[i + 1];
  a[i + 2] += alpha * b[i + 2];
  a[i + 3] += alpha * b[i + 3];
  a[i + 4] += alpha * b[i + 4];
}

and turn them into this:

for (int i = 0; i < 3200; ++i) {
  a[i] += alpha * b[i];
}

and loops like this:

for (int i = 0; i < 500; ++i) {
  x[3*i] = foo(0);
  x[3*i+1] = foo(0);
  x[3*i+2] = foo(0);
}

and turn them into this:

for (int i = 0; i < 1500; ++i) {
  x[i] = foo(0);
}

There are two motivations for this transformation:

  1. Code-size reduction (especially relevant, obviously, when compiling for
code size).

  2. Providing greater choice to the loop vectorizer (and generic unroller) to
choose the unrolling factor (and a better ability to vectorize). The loop
vectorizer can take vector lengths and register pressure into account when
choosing an unrolling factor, for example, and a pre-unrolled loop limits that
choice. This is especially problematic if the manual unrolling was optimized
for a machine different from the current target.

The current implementation is limited to single basic-block loops only. The
rerolling recognition should work regardless of how the loop iterations are
intermixed within the loop body (subject to dependency and side-effect
constraints), but the significant restriction is that the order of the
instructions in each iteration must be identical. This seems sufficient to
capture all current use cases.

This pass is not currently enabled by default at any optimization level.

llvm-svn: 194939
2013-11-16 23:59:05 +00:00
Fariborz Jahanian 2c31212827 ObjectiveC ARC. More validation of toll-free bridging of
CF objects with objc_bridge'ing annotaiton.
// rdar://15454846

llvm-svn: 194938
2013-11-16 23:22:37 +00:00
Juergen Ributzka 565acf9278 The WebKit_JS CC preserves the same registers as the C CC.
llvm-svn: 194936
2013-11-16 22:08:58 +00:00
Hal Finkel 12100bf7e8 Apply the InstCombine fptrunc sqrt optimization to llvm.sqrt
InstCombine, in visitFPTrunc, applies the following optimization to sqrt calls:

  (fptrunc (sqrt (fpext x))) -> (sqrtf x)

but does not apply the same optimization to llvm.sqrt. This is a problem
because, to enable vectorization, Clang generates llvm.sqrt instead of sqrt in
fast-math mode, and because this optimization is being applied to sqrt and not
applied to llvm.sqrt, sometimes the fast-math code is slower.

This change makes InstCombine apply this optimization to llvm.sqrt as well.

This fixes the specific problem in PR17758, although the same underlying issue
(optimizations applied to libcalls are not applied to intrinsics) exists for
other optimizations in SimplifyLibCalls.

llvm-svn: 194935
2013-11-16 21:29:08 +00:00
Matt Arsenault dfb3e7092e Fix assert on unaligned access to global with different address space size.
llvm-svn: 194934
2013-11-16 20:50:54 +00:00
Matt Arsenault 19231e630e Fix codegen for null different sized pointer.
llvm-svn: 194932
2013-11-16 20:24:41 +00:00
Tobias Grosser 378a9f2b91 ScopDetection: Improve formatting
llvm-svn: 194931
2013-11-16 19:34:11 +00:00
Fariborz Jahanian 8a0210e535 ObjectiveC ARC. Validate toll free bridge casting
of ObjectiveC objects to CF types when CF type
has the objc_bridge attribute.

llvm-svn: 194930
2013-11-16 19:16:32 +00:00
Benjamin Kramer c6f955763e ScalarEvolution: Warn if the result of setFlags/clearFlags is unused.
This was a source of bugs in the past.

llvm-svn: 194929
2013-11-16 16:25:47 +00:00
Benjamin Kramer 5f2768c377 Annotate APInt methods where it's not clear whether they are in place with warn_unused_result.
Fix ScalarEvolution bugs uncovered by this.

llvm-svn: 194928
2013-11-16 16:25:41 +00:00
Vincent Lejeune 745d4298b1 R600: Make dot_4 instructions predicable
llvm-svn: 194927
2013-11-16 16:24:41 +00:00
Duncan P. N. Exon Smith 0c8d604fed Use array_pod_sort instead of std::sort
Per Rafael's review of r194514.

llvm-svn: 194926
2013-11-16 16:15:56 +00:00
Benjamin Kramer 03f3e248eb InstCombine: fold (A >> C) == (B >> C) --> (A^B) < (1 << C) for constant Cs.
This is common in bitfield code.

llvm-svn: 194925
2013-11-16 16:00:48 +00:00
Duncan P. N. Exon Smith 38fc2e7a47 Fix filename in header comment
llvm-svn: 194924
2013-11-16 15:40:54 +00:00
Sebastian Pop 3d1806b907 prepend LLVM to all Polly* libs
llvm-svn: 194923
2013-11-16 15:28:55 +00:00
Sebastian Pop 8d6cca1906 factor out code in shouldEnablePolly
to be able to call the same functionality from registerPollyEarlyAsPossiblePasses
and registerPollyOptLevel0Passes.

llvm-svn: 194922
2013-11-16 15:28:49 +00:00
Sebastian Pop 4915ccbe8b move MayAliasSet.cpp into lib/Analysis
llvm-svn: 194921
2013-11-16 15:28:45 +00:00
Benjamin Kramer 847c1d90e1 Remove unused but set variable.
llvm-svn: 194920
2013-11-16 11:47:52 +00:00
Alp Toker b504417b03 Move remaining %clang_cc1 tests out of test/Driver
clang -cc1 skips the driver so it never made sense to include these with the
Driver tests.

Basic type tests and flag tests generally both go in Frontend.

Now that the final -cc1 tests have been moved out of test/Driver, add a
local substitution to enforce and detect future mistakes.

These miscategorized tests were probably the source of confusion in r194817.

llvm-svn: 194919
2013-11-16 06:20:17 +00:00
NAKAMURA Takumi f8d6c690c5 gtest-death-test.cc: Move ~DeathTestFactory() to unbreak cygming build since r194865.
llvm-svn: 194918
2013-11-16 05:26:49 +00:00
Manman Ren 23662907fc Debug Info Verifier: remove un-used argument in verifyDebugInfo.
No functionality change.

llvm-svn: 194917
2013-11-16 02:34:57 +00:00
Richard Smith fa27bc4c7b If a replaceable global operator new/delete is marked inline, don't warn if
it's also __attribute__((used)), since that undoes the problematic part of
'inline'.

llvm-svn: 194916
2013-11-16 01:57:09 +00:00
Fariborz Jahanian f07183ce94 ObjetiveC ARC. Start diagnosing invalid toll free bridging.
// rdar://15454846.

llvm-svn: 194915
2013-11-16 01:45:25 +00:00
Rui Ueyama b37c431d53 Move the entire debug print loop into DEBUG_WITH_TYPE.
No functionality change.

llvm-svn: 194914
2013-11-16 01:41:47 +00:00
Rui Ueyama a3ada6b0f7 Replace one more magic number with sizeof().
llvm-svn: 194913
2013-11-16 01:31:24 +00:00
Jason Molenda 8ee9cb5891 Add a new SBThread::GetExtendedBacktraceOriginatingIndexID() method
(and same thing to Thread base class) which can be used when looking
at an ExtendedBacktrace thread; it will try to find the IndexID() of
the original thread that was executing this backtrace when it was
recorded.  If lldb can't find a record of that thread, it will return
the same value as IndexID() for the ExtendedBacktrace thread.

llvm-svn: 194912
2013-11-16 01:24:22 +00:00
Rui Ueyama 5dcabbc9e8 Use early continue.
llvm-svn: 194911
2013-11-16 01:14:37 +00:00
Tobias Grosser 1c84d80457 Style fixes, brought to you by clang-format
llvm-svn: 194910
2013-11-16 01:07:06 +00:00
Rui Ueyama e4d20ab786 Simplify. No functionality change.
llvm-svn: 194909
2013-11-16 01:01:35 +00:00
Rui Ueyama 4072d91a58 Replace duplicate code with calls to getOrPushAttribute().
llvm-svn: 194908
2013-11-16 00:55:08 +00:00
Jim Grosbach 82eee26877 X86: Make specifying avx2 simpler on Darwin with '-arch'
Teach the '-arch' command line option to enable the compiler-friendly
features of core-avx2 CPUs on Darwin. Pass the information along in the
target triple like Darwin+ARM does.

llvm-svn: 194907
2013-11-16 00:53:35 +00:00
Jim Grosbach 664d148a92 X86: Encode the 'h' cpu subtype in the MachO header for x86.
llvm-svn: 194906
2013-11-16 00:52:57 +00:00
Richard Smith 13dfdc88a9 Downgrade the Error on an 'inline' operator new or delete to an ExtWarn. Some
projects are relying on such (questionable) practices, so we should give them
a way to opt out of this diagnostic.

llvm-svn: 194905
2013-11-16 00:47:38 +00:00
Matt Arsenault b83422612a Mention address space related changes in release notes.
llvm-svn: 194904
2013-11-16 00:36:46 +00:00
Matt Arsenault a8fe22baba Use correct size for address space in BasicAA.
The tests just hit this with a different sized
address space since I haven't figured out how
to use this to break it.

I thought I committed this a long time ago,
and I'm not sure why missing this hasn't caused
any problems.

llvm-svn: 194903
2013-11-16 00:36:43 +00:00