Commit Graph

10964 Commits

Author SHA1 Message Date
Yi Jiang
ab906d0048 Apply transformation on OS X 10.9+ and iOS 7.0+: pow(10, x) ―> __exp10(x)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 22:42:50 +00:00
Renato Golin
07d9471bc5 Add #pragma vectorize enable/disable to LLVM
The intended behaviour is to force vectorization on the presence
of the flag (either turn on or off), and to continue the behaviour
as expected in its absence. Tests were added to make sure the all
cases are covered in opt. No tests were added in other tools with
the assumption that they should use the PassManagerBuilder in the
same way.

This patch also removes the outdated -late-vectorize flag, which was
on by default and not helping much.

The pragma metadata is being attached to the same place as other loop
metadata, but nothing forbids one from attaching it to a function
(to enable #pragma optimize) or basic blocks (to hint the basic-block
vectorizers), etc. The logic should be the same all around.

Patches to Clang to produce the metadata will be produced after the
initial implementation is agreed upon and committed. Patches to other
vectorizers (such as SLP and BB) will be added once we're happy with
the pass manager changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196537 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 21:20:02 +00:00
Michael Gottesman
f3f9cff0fb Change std::deque => std::vector. No functionality change.
There is no reason to use std::deque here over std::vector. Thus given the
performance differences inbetween the two it makes sense to change deque to
vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196524 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 18:42:12 +00:00
Rafael Espindola
3bb1184a1a Fix non-deterministic behavior.
We use CSEBlocks to initialize a worklist:

SmallVector<BasicBlock *, 8> CSEWorkList(CSEBlocks.begin(), CSEBlocks.end());

so it must have a deterministic order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196520 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 18:28:01 +00:00
Arnold Schwaighofer
9e0807cb61 SLPVectorizer: An in-tree vectorized entry cannot also be a scalar external use
We were creating external uses for scalar values in MustGather entries that also
had a ScalarToTreeEntry (they also are present in a vectorized tuple). This
meant we would keep a value 'alive' as a scalar and vectorized causing havoc.
This is not necessary because when we create a MustGather vector we explicitly
create external uses entries for the insertelement instructions of the
MustGather vector elements.

Fixes PR18129.

radar://15582184

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196508 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 15:14:40 +00:00
Kostya Serebryany
64abf5b441 [tsan] fix PR18146: sometimes a variable written into vptr could have an integer type (after other optimizations)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196507 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 15:03:02 +00:00
Alp Toker
087ab613f4 Correct word hyphenations
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities and contractions in nearby lines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196471 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 05:44:44 +00:00
Yuchen Wu
6aff9d6f91 llvm-cov: Replace size() with empty() in bool check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196400 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 19:18:23 +00:00
Daniel Jasper
bfbf8d3ad8 Un-revert r196358: "llvm-cov: Added support for function checksums."
And add the proper fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196367 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 08:57:17 +00:00
Daniel Jasper
b835a4403a Revert r196358: "llvm-cov: Added support for function checksums."
This currently breaks clang/test/CodeGen/code-coverage.c. The root cause
is that the newly introduced access to Funcs[j] is out of bounds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196365 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 08:23:33 +00:00
Yuchen Wu
2ebea72474 llvm-cov: Added support for function checksums.
The function checksums are hashed from the concatenation of the function
name and line number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196358 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 06:00:17 +00:00
Yunzhong Gao
822a02fb4c Teach the internalize pass to skip dllexported symbols because they could be
referenced in a way that even the linker does not see.

Differential Revision: http://llvm-reviews.chandlerc.com/D2280



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196300 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-03 18:05:14 +00:00
Kay Tiong Khoo
ddc7eef2cd Use local variable for repeated use rather than 'get' method. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 22:23:32 +00:00
Kay Tiong Khoo
3059b474a4 Move variables to where they are used and give them better names. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 22:20:40 +00:00
Kay Tiong Khoo
5685c012a3 Rename variables to be consistent (CST -> Cst). No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196161 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 22:11:56 +00:00
Mark Seaborn
6e2cf928d0 InlineFunction.cpp: Remove a return value that is always false
Remove some associated dead code.

This cleanup is associated with PR17872.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196147 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 20:50:59 +00:00
Kay Tiong Khoo
4e5f6e64f1 Conservative fix for PR17827 - don't optimize a shift + and + compare sequence where the shift is logical unless the comparison is unsigned
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196129 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 18:43:59 +00:00
Kostya Serebryany
dfb74a58c5 [tsan] fix instrumentation of vector vptr updates (https://code.google.com/p/thread-sanitizer/issues/detail?id=43)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196079 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02 08:07:15 +00:00
Bill Wendling
47cc074c2e Use accessor methods instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196006 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-01 03:40:42 +00:00
Bill Wendling
6e59964b45 Use 'unsigned char' to get this past gcc error message:
error: invalid conversion from 'unsigned char' to '{anonymous}::Sequence'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-01 03:36:07 +00:00
Stephen Canon
e9f8ce8cde Rein in overzealous InstCombine of fptrunc(OP(fpextend, fpextend)).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195934 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-28 21:38:05 +00:00
Nadav Rotem
7e8ff837e6 PR1860 - We can't save a list of ExtractElement instructions to CSE because some of these instructions
may be removed and optimized in future iterations. Instead we save a list of basic blocks that we need to CSE.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195791 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 22:24:25 +00:00
Arnold Schwaighofer
b40f14eb89 LoopVectorizer: Truncate i64 trip counts of i32 phis if necessary
In signed arithmetic we could end up with an i64 trip count for an i32 phi.
Because it is signed arithmetic we know that this is only defined if the i32
does not wrap. It is therefore safe to truncate the i64 trip count to a i32
value.

Fixes PR18049.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195787 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 22:11:23 +00:00
Diego Novillo
d0d8d6462a Refactor some code in SampleProfile.cpp
I'm adding new functionality in the sample profiler. This will
require more data to be kept around for each function, so I moved
the structure SampleProfile that we keep for each function into
a separate class.

There are no functional changes in this patch. It simply provides
a new home where to place all the new data that I need to propagate
weights through edges.

There are some other name and minor edits throughout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195780 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 20:37:33 +00:00
Nadav Rotem
bba8da2ba0 PR18060 - When we RAUW values with ExtractElement instructions in some cases
we generate PHI nodes with multiple entries from the same basic block but
with different values. Enabling CSE on ExtractElement instructions make sure
that all of the RAUWed instructions are the same.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195773 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 17:29:19 +00:00
Stepan Dyatkovskiy
dff57f19a1 PR17925 bugfix.
Short description.

This issue is about case of treating pointers as integers.
We treat pointers as different if they references different address space.
At the same time, we treat pointers equal to integers (with machine address
width). It was a point of false-positive. Consider next case on 32bit machine:

void foo0(i32 addrespace(1)* %p)
void foo1(i32 addrespace(2)* %p)
void foo2(i32 %p)

foo0 != foo1, while
foo1 == foo2 and foo0 == foo2.

As you can see it breaks transitivity. That means that result depends on order
of how functions are presented in module. Next order causes merging of foo0
and foo1: foo2, foo0, foo1
First foo0 will be merged with foo2, foo0 will be erased. Second foo1 will be
merged with foo2.
Depending on order, things could be merged we don't expect to.

The fix:
Forbid to treat any pointer as integer, except for those, who belong to address space 0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195769 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 16:11:03 +00:00
Chandler Carruth
54fec07ec0 [PM] Split the CallGraph out from the ModulePass which creates the
CallGraph.

This makes the CallGraph a totally generic analysis object that is the
container for the graph data structure and the primary interface for
querying and manipulating it. The pass logic is separated into its own
class. For compatibility reasons, the pass provides wrapper methods for
most of the methods on CallGraph -- they all just forward.

This will allow the new pass manager infrastructure to provide its own
analysis pass that constructs the same CallGraph object and makes it
available. The idea is that in the new pass manager, the analysis pass's
'run' method returns a concrete analysis 'result'. Here, that result is
a 'CallGraph'. The 'run' method will typically do only minimal work,
deferring much of the work into the implementation of the result object
in order to be lazy about computing things, but when (like DomTree)
there is *some* up-front computation, the analysis does it prior to
handing the result back to the querying pass.

I know some of this is fairly ugly. I'm happy to change it around if
folks can suggest a cleaner interim state, but there is going to be some
amount of unavoidable ugliness during the transition period. The good
thing is that this is very limited and will naturally go away when the
old pass infrastructure goes away. It won't hang around to bother us
later.

Next up is the initial new-PM-style call graph analysis. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195722 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 04:19:30 +00:00
Chandler Carruth
fbe605e712 Migrate metadata information from scalar to vector instructions during
SLP vectorization. Based on the code in BBVectorizer.

Fixes PR17741.

Patch by Raul Silvera, reviewed by Hal and Nadav. Reformatted by my
driving of clang-format. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195528 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-23 00:48:34 +00:00
Yuchen Wu
695de7692c llvm-cov: Split entry blocks in GCNOProfiling.cpp.
gcov expects every function to contain an entry block that
unconditionally branches into the next block. clang does not implement
basic blocks in this manner, so gcov did not output correct branch info
if the entry block branched to multiple blocks.

This change splits every function's entry block into an empty block and
a block with the rest of the instructions. The instrumentation code will
take care of the rest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195513 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 23:07:45 +00:00
Manman Ren
e6c749a3ec Debug Info: move StripDebugInfo from StripSymbols.cpp to DebugInfo.cpp.
We can share the implementation between StripSymbols and dropping debug info
for metadata versions that do not match.

Also update the comments to match the implementation. A follow-on patch will
drop the "Debug Info Version" module flag in StripDebugInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 22:06:31 +00:00
Matt Arsenault
08e1b756df StructurizeCFG: Fix verification failure with some loops.
If the beginning of the loop was also the entry block
of the function, branches were inserted to the entry block
which isn't allowed. If this occurs, create a new dummy
function entry block that branches to the start of the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195493 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 19:24:39 +00:00
Matt Arsenault
7575fdd7a4 StructurizeCFG: Fix inverting a branch on an argument
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195492 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 19:24:37 +00:00
Rafael Espindola
4799cdb81e Add a fixed version of r195470 back.
The fix is simply to use CurI instead of I when handling aliases to
avoid accessing a invalid iterator.

original message:

Convert linkonce* to weak* instead of strong.

Also refactor the logic into a helper function. This is an important improve
on mingw where the linker complains about mixed weak and strong symbols.
Converting to weak ensures that the symbol is not dropped, but keeps in a
comdat, making the linker happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195477 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 17:58:12 +00:00
Rafael Espindola
4be5f33f65 Revert "Convert linkonce* to weak* instead of strong."
This reverts commit r195470.
Debugging failure in some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195472 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 17:09:34 +00:00
Richard Sandiford
0f778794c8 Add a Scalarizer pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195471 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 16:58:05 +00:00
Rafael Espindola
a6c0249619 Convert linkonce* to weak* instead of strong.
Also refactor the logic into a helper function. This is an important improvement
on mingw where the linker complains about mixed weak and strong symbols.
Converting to weak ensures that the symbol is not dropped, but keeps in a
comdat, making the linker happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195470 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 16:14:30 +00:00
Arnold Schwaighofer
21a47246f9 SLPVectorizer: Fix whitespace errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195468 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 15:47:17 +00:00
Yi Jiang
709a31b5f9 SLP Vectorizer: Extract cost will only be added once even if the scalar has multiple external uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195406 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-22 01:57:02 +00:00
Peter Collingbourne
934d1f83ae Introduce two command-line flags for the instrumentation pass to control whether the labels of pointers should be ignored in load and store instructions
The new command line flags are -dfsan-ignore-pointer-label-on-store and -dfsan-ignore-pointer-label-on-load. Their default value matches the current labelling scheme.

Additionally, the function __dfsan_union_load is marked as readonly.

Patch by Lorenzo Martignoni!

Differential Revision: http://llvm-reviews.chandlerc.com/D2187

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195382 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 23:20:54 +00:00
Evgeniy Stepanov
52658c9db5 [msan] Propagate condition origin in select instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195349 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 12:00:24 +00:00
Yuchen Wu
1155e0e912 llvm-cov: Don't assume FileChecksum was generated.
For cases where emitProfileArcs() was called but emitProfileNotes() was
not, set the CfgChecksum to 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195311 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 04:53:39 +00:00
Yuchen Wu
6431960be3 llvm-cov: Fixed some bugs related to file checksum.
Added call to update CfgChecksum. Made FileChecksum a vector, separate
for each source file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195309 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-21 04:01:05 +00:00
Yuchen Wu
d23c759c0f llvm-cov: Added file checksum to gcno and gcda files.
Instead of permanently outputting "MVLL" as the file checksum, clang
will create gcno and gcda checksums by hashing the destination block
numbers of every arc. This allows for llvm-cov to check if the two gcov
files are synchronized.

Regenerated the test files so they contain the checksum. Also added
negative test to ensure error when the checksums don't match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195191 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 04:15:05 +00:00
Arnold Schwaighofer
4bc2e3a32d SLPVectorizer: Fix stale for Value pointer array
We are slicing an array of Value pointers and process those slices in a loop.
The problem is that we might invalidate a later slice by vectorizing a former
slice.

Use a WeakVH to track the pointer. If the pointer is deleted or RAUW'ed we can
tell.

The test case will only fail when running with libgmalloc.

radar://15498655

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195162 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 22:20:20 +00:00
Arnold Schwaighofer
413f7bea8d SLPVectorizer: Fix whitespace errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195161 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 22:20:18 +00:00
Chandler Carruth
ed1951e79f Fix an issue where SROA computed different results based on the relative
order of slices of the alloca which have exactly the same size and other
properties. This was found by a perniciously unstable sort
implementation used to flush out buggy uses of the algorithm.

The fundamental idea is that findCommonType should return the best
common type it can find across all of the slices in the range. There
were two bugs here previously:

1) We would accept an integer type smaller than a byte-width multiple,
   and if there were different bit-width integer types, we would accept
   the first one. This caused an actual failure in the testcase updated
   here when the sort order changed.
2) If we found a bad combination of types or a non-load, non-store use
   before an integer typed load or store we would bail, but if we found
   the integere typed load or store, we would use it. The correct
   behavior is to always use an integer typed operation which covers the
   partition if one exists.

While a clever debugging sort algorithm found problem #1 in our existing
test cases, I have no useful test case ideas for #2. I spotted in by
inspection when looking at this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195118 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 09:03:18 +00:00
Michael Ilseman
1b3ab9199f Add support for software expansion of 64-bit integer division instructions.
Patch by Dmitri Shtilman!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195116 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 06:54:19 +00:00
Adrian Prantl
940267e7f2 Debug info: Let LowerDbgDeclare perfom the dbg.declare -> dbg.value
lowering only for load/stores to scalar allocas. The resulting values
confuse the backend and don't add anything because we can describe
array-allocas with a dbg.declare intrinsic just fine.

rdar://problem/15464571

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195052 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 23:04:38 +00:00
Alexey Samsonov
64409ad8e3 [ASan] Fix PR17867 - make sure ASan doesn't crash if use-after-scope and use-after-return are combined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195014 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 14:53:55 +00:00
Arnold Schwaighofer
07a3c481c6 LoopVectorizer: Extend the induction variable to a larger type
In some case the loop exit count computation can overflow. Extend the type to
prevent most of those cases.

The problem is loops like:
int main ()
{
  int a = 1;
  char b = 0;
  lbl:
    a &= 4;
    b--;
    if (b) goto lbl;
  return a;
}

The backedge count is 255. The induction variable type is i8. If we add one to
255 to get the exit count we overflow to zero.

To work around this issue we extend the type of the induction variable to i32 in
the case of i8 and i16.

PR17532

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195008 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 13:14:32 +00:00