Commit Graph

670 Commits

Author SHA1 Message Date
NAKAMURA Takumi 3ead47e718 ADTTests: [CMake] Exclude DenseMapTest.cpp and SmallVectorTest.cpp on MSVC9 due to its bug.
llvm-svn: 162918
2012-08-30 16:22:32 +00:00
Richard Smith c4379c3b7e Don't pass a null pointer to cast<> in its unit tests.
llvm-svn: 162310
2012-08-21 20:39:25 +00:00
Benjamin Kramer 1b07ab51e4 DataExtractor: Fix integer truncation issues in LEB128 extraction.
llvm-svn: 162201
2012-08-20 10:52:11 +00:00
Chandler Carruth 9b9cec24b8 Flatten the aligned-char-array utility template to be a directly
templated union at the request of Richard Smith. This makes it
substantially easier to type. =]

llvm-svn: 162072
2012-08-17 01:47:25 +00:00
Michael J. Spencer 135611f7fc Properly test the LLVM_USE_RVALUE_REFERENCES macro.
llvm-svn: 161979
2012-08-15 19:21:42 +00:00
Michael J. Spencer ef2284fbad [PathV2] Add mapped_file_region. Implementation for Windows and POSIX.
llvm-svn: 161976
2012-08-15 19:05:47 +00:00
Owen Anderson 352dfff447 Fix another roundToIntegral bug where very large values could become infinity. Problem and solution identified by Steve Canon.
llvm-svn: 161969
2012-08-15 18:28:45 +00:00
Owen Anderson 1ff74b0d2d Fix a problem with APFloat::roundToIntegral where it would return incorrect results for negative inputs to trunc. Add unit tests to verify this behavior.
llvm-svn: 161929
2012-08-15 05:39:46 +00:00
Alexander Kornienko 8c724a758b Added test for non-static use of cl::opt (fixed in r160170)
llvm-svn: 161751
2012-08-13 10:43:36 +00:00
Benjamin Kramer 6d29c29631 Update cmake build.
llvm-svn: 161297
2012-08-04 09:52:39 +00:00
Benjamin Kramer 3849fcbe0e Postpone the deletion of the old name in StructType::setName to allow using a slice of the old name.
Fixes PR13522. Add a rudimentary unit test to exercise the behavior.

llvm-svn: 161296
2012-08-04 09:47:02 +00:00
Chandler Carruth f2113f3b48 Add range erase, element insert, and range insert methods to
TinyPtrVector. With these, it is sufficiently functional for my more
normal / pedestrian uses.

I've not included some r-value reference stuff here because the value
type for a TinyPtrVector is, necessarily, just a pointer.

I've added tests that cover the basic behavior of these routines, but
they aren't as comprehensive as I'd like. In particular, they don't
really test the iterator semantics as thoroughly as they should. Maybe
some brave soul will feel enterprising and flesh them out. ;]

llvm-svn: 161104
2012-08-01 08:40:48 +00:00
Nick Kledzik 5fce8c4ffe Initial commit of new FileOutputBuffer support class.
Since the llvm::sys::fs::map_file_pages() support function it relies on
is not yet implemented on Windows, the unit tests for FileOutputBuffer 
are currently conditionalized to run only on unix.

llvm-svn: 161099
2012-08-01 02:29:50 +00:00
Akira Hatanaka 0820f0ca8e Implement MipsJITInfo::replaceMachineCodeForFunction.
No new test case is added.
This patch makes test JITTest.FunctionIsRecompiledAndRelinked pass on mips
platform.

Patch by Petar Jovanovic.

llvm-svn: 161098
2012-08-01 02:29:24 +00:00
Nick Kledzik 204720bc71 Suppress stderr noise when test case runs.
llvm-svn: 161085
2012-07-31 22:18:15 +00:00
Chandler Carruth 94ed210702 Implement copy and move assignment for TinyPtrVector. These try to
re-use allocated vectors as much as possible.

llvm-svn: 161041
2012-07-31 09:42:24 +00:00
Chandler Carruth a565375a18 Bring TinyPtrVector under test. Somehow we never picked up unit tests
for this class. These tests exercise most of the basic properties, but
the API for TinyPtrVector is very strange currently. My plan is to start
fleshing out the API to match that of SmallVector, but I wanted a test
for what is there first.

Sadly, it doesn't look reasonable to just re-use the SmallVector tests,
as this container can only ever store pointers, and much of the
SmallVector testing is to get construction and destruction right.

Just to get this basic test working, I had to add value_type to the
interface.

While here I found a subtle bug in the combination of 'erase', 'begin',
and 'end'. Both 'begin' and 'end' wanted to use a null pointer to
indicate the "end" iterator of an empty vector, regardless of whether
there is actually a vector allocated or the pointer union is null.
Everything else was fine with this except for erase. If you erase the
last element of a vector after it has held more than one element, we
return the end iterator of the underlying SmallVector which need not be
a null pointer. Instead, simply use the pointer, and poniter + size()
begin/end definitions in the tiny case, and delegate to the inner vector
whenever it is present.

llvm-svn: 161024
2012-07-31 02:48:31 +00:00
Chandler Carruth 0b01261cb0 Move the SmallVector unit tests to be type-parameterized so that we can
test more than a single instantiation of SmallVector.

Add testing for 0, 1, 2, and 4 element sized "small" buffers. These
appear to be essentially untested in the unit tests until now.

Fix several tests to be robust in the face of a '0' small buffer. As
a consequence of this size buffer, the growth patterns are actually
observable in the test -- yes this means that many tests never caused
a grow to occur before. For some tests I've merely added a reserve call
to normalize behavior. For others, the growth is actually interesting,
and so I captured the fact that growth would occur and adjusted the
assertions to not assume how rapidly growth occured.

Also update the specialization for a '0' small buffer length to have all
the same interface points as the normal small vector.

llvm-svn: 161001
2012-07-30 22:17:52 +00:00
Nuno Lopes eb9d2755b2 make ConstantRange::zeroExtend() optimal
llvm-svn: 160643
2012-07-23 20:33:29 +00:00
Nuno Lopes 986cc181b0 teach ConstantRange that zero times X is always zero
llvm-svn: 160317
2012-07-16 20:47:16 +00:00
Nuno Lopes 99504c577c make ConstantRange::getSetSize() properly compute the size of wrapped and full sets.
Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients

llvm-svn: 160294
2012-07-16 18:08:12 +00:00
Chandler Carruth f5fe556c70 Add support for attaching branch weight metadata directly from the IRBuilder.
Added a basic unit test for this with CreateCondBr. I didn't go all the
way and test the switch side as the boilerplate for setting up the
switch IRBuilder unit tests is a lot more. Fortunately, the two share
all the interesting code paths.

llvm-svn: 160251
2012-07-16 07:45:06 +00:00
Chandler Carruth b39c55f4be Add a boring bit of boilerplate to start testing IRBuilder::CreateCondBr.
This is in anticipation of changing CreateCondBr and wanting to test
those changes.

llvm-svn: 160250
2012-07-16 07:44:51 +00:00
Chandler Carruth ebabadf933 Move the IRBuilder unittest from Support to VMCore. This got missed in
the original move of IRBuilder.

llvm-svn: 160249
2012-07-16 07:44:45 +00:00
Chandler Carruth 36e2ecf528 Move llvm/Support/TypeBuilder.h -> llvm/TypeBuilder.h. This completes
the move of *Builder classes into the Core library.

No uses of this builder in Clang or DragonEgg I could find.

If there is a desire to have an IR-building-support library that
contains all of these builders, that can be easily added, but currently
it seems likely that these add no real overhead to VMCore.

llvm-svn: 160243
2012-07-15 23:45:24 +00:00
Chandler Carruth ec7ad6561f Move llvm/Support/MDBuilder.h to llvm/MDBuilder.h, to live with
IRBuilder, DIBuilder, etc.

This is the proper layering as MDBuilder can't be used (or implemented)
without the Core Metadata representation.

Patches to Clang and Dragonegg coming up.

llvm-svn: 160237
2012-07-15 23:26:50 +00:00
Eric Christopher b65acc61a5 Revert "IntRange:" as it appears to be breaking self hosting.
This reverts commit b2833d9dcba88c6f0520cad760619200adc0442c.

llvm-svn: 159618
2012-07-02 23:22:21 +00:00
Stepan Dyatkovskiy 8b9ecca42d IntRange:
- Changed isSingleNumber method behaviour. Now this flag is calculated on demand.
IntegersSubsetMapping
  - Optimized diff operation.
  - Replaced type of Items field from std::list with std::map.
  - Added new methods:
    bool isOverlapped(self &RHS)
    void add(self& RHS, SuccessorClass *S)
    void detachCase(self& NewMapping, SuccessorClass *Succ)
    void removeCase(SuccessorClass *Succ)
    SuccessorClass *findSuccessor(const IntTy& Val)
    const IntTy* getCaseSingleNumber(SuccessorClass *Succ)
IntegersSubsetTest
  - DiffTest: Added checks for successors.
SimplifyCFG
  Updated SwitchInst usage (now it is case-ragnes compatible) for
    - SimplifyEqualityComparisonWithOnlyPredecessor
    - FoldValueComparisonIntoPredecessors

llvm-svn: 159527
2012-07-02 13:02:18 +00:00
Chandler Carruth aafe0918bc Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h
This was always part of the VMCore library out of necessity -- it deals
entirely in the IR. The .cpp file in fact was already part of the VMCore
library. This is just a mechanical move.

I've tried to go through and re-apply the coding standard's preferred
header sort, but at 40-ish files, I may have gotten some wrong. Please
let me know if so.

I'll be committing the corresponding updates to Clang and Polly, and
Duncan has DragonEgg.

Thanks to Bill and Eric for giving the green light for this bit of cleanup.

llvm-svn: 159421
2012-06-29 12:38:19 +00:00
Bill Wendling f799efdedc The DIBuilder class is just a wrapper around debug info creation
(a.k.a. MDNodes). The module doesn't belong in Analysis. Move it to the VMCore
instead.

llvm-svn: 159414
2012-06-29 08:32:07 +00:00
Nuno Lopes 5020db2a8c add ConstantRange::difference (to perform set difference/relative complement)
llvm-svn: 159352
2012-06-28 16:10:13 +00:00
Nuno Lopes ebb0c94e1b fix a off-by-one bug in intersectWith(), and add a bunch of tests
llvm-svn: 159319
2012-06-28 00:59:33 +00:00
Bill Wendling e38859dc8e Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and
include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h.

The reasoning is because the DebugInfo module is simply an interface to the
debug info MDNodes and has nothing to do with analysis.

llvm-svn: 159312
2012-06-28 00:05:13 +00:00
Stepan Dyatkovskiy 593d358cf3 IntegersSubsetTest: Due to compilation failure with -std=c11, replaced -1UL with NOT_A_NUMBER constant (0xffff).
llvm-svn: 159207
2012-06-26 16:08:20 +00:00
Stepan Dyatkovskiy e481e0daf4 IntegersSubsetMapping: implemented "diff" operation. Operation allows at the same time perform up to three operations:
- LHS exclude RHS
- LHS intersect RHS (LHS successors will keeped)
- RHS exclude LHS
The complexity is N+M, where
  N is size of LHS
  M is size of RHS.

llvm-svn: 159201
2012-06-26 11:57:43 +00:00
Stepan Dyatkovskiy 883850c4d2 IntegersSubsetMapping: removed exclude operation, it will replaced with more universal "diff" operation in next commit.
Changes was separated onto two commits for better readability.

llvm-svn: 159200
2012-06-26 11:41:47 +00:00
NAKAMURA Takumi c8919dd7fd unittests/Support/Path.cpp: [Win32] Suppress FileSystemTest.FileMapping for now.
llvm-svn: 159099
2012-06-24 03:48:40 +00:00
NAKAMURA Takumi 787ea1f3cc unittests/Support/Path.cpp: [Win32] Suppress FileSystemTest.Permissions for now.
llvm-svn: 159098
2012-06-24 03:48:34 +00:00
NAKAMURA Takumi 6fed668d25 llvm/unittests: Simplify LINK_COMPONENTS.
llvm-svn: 158942
2012-06-21 22:17:51 +00:00
NAKAMURA Takumi e14e13d971 llvm/unittests/VMCore/CMakeLists.txt: Introduce LLVM_OPTIONAL_SOURCES here, too.
llvm-svn: 158941
2012-06-21 22:17:39 +00:00
NAKAMURA Takumi 9573c48aae llvm/unittests/ExecutionEngine/JIT/CMakeLists.txt: Unbreak build.
llvm-svn: 158914
2012-06-21 12:44:58 +00:00
Chandler Carruth 92f2f37bae Add a pragma to supress an MSVC warning on some of the absurd code I'm
using to test the alignment support library.

Patch from Nikola on IRC.

llvm-svn: 158912
2012-06-21 10:02:41 +00:00
Chandler Carruth 33af93f7a6 Add some missing dependencies here that I missed in my first pass
through. Also sort them.

llvm-svn: 158911
2012-06-21 10:02:40 +00:00
Chandler Carruth 94d0251824 Completely refactor the structuring of unittest CMake files to match the
Makefiles, the CMake files in every other part of the LLVM tree, and
sanity.

This should also restore the output tree structure of all the unit
tests, sorry for breaking that, and thanks for letting me know.

The fundamental change is to put a CMakeLists.txt file in the unittest
directory, with a single test binary produced from it. This has several
advantages:

- No more weird directory stripping in the unittest macro, allowing it
  to be used more readily in other projects.
- No more directory prefixes on all the source files.
- Allows correct and precise use of LLVM's per-directory dependency
  system.
- Allows use of the checking logic for source files that have not been
  added to the CMake build. This uncovered a file being skipped with
  CMake in LLVM and one in Clang's unit tests.
- Makes Specifying conditional compilation or other custom logic for JIT
  tests easier.

It did require adding the concept of an explicit 'optional' source file
to the CMake build so that the missing-file check can skip cases where
the file is *supposed* to be missing. =]

This is another chunk of refactoring the CMake build in order to make it
usable for other clients like CompilerRT / ASan / TSan.

Note that this is interdependent with a Clang CMake change.

llvm-svn: 158909
2012-06-21 09:51:26 +00:00
Chandler Carruth a5d42f83f9 Factor the logic for setting up a GoogleTest unit test executable into
a helper function in CMake. This will allow us to share all of this
logic with Clang, and eventually CompilerRT.

llvm-svn: 158896
2012-06-21 05:16:58 +00:00
Chandler Carruth 1313d9860d Simplify the naming pattern in the unittests' CMake file
llvm-svn: 158893
2012-06-21 02:02:48 +00:00
Chandler Carruth e530d2ba4d Remove one of the LLVM-specific CMake hacks in favor of standard CMake
facilities.

This was only used in one place in LLVM, and was used pervasively (but
with different code!) in Clang. It has no advantages over the standard
CMake facilities and in some cases disadvantages.

llvm-svn: 158889
2012-06-21 01:35:09 +00:00
Chandler Carruth 35e6706675 Fix inappropriate use of anonymous namespaces in unittests.
The TEST_F macros actually declare *subclasses* of the test fixtures.
Even if they didn't we don't want them to declare external functions.
The entire unit test, including both the fixture class and the fixture
test cases should be wrapped in the anonymous namespace.

This issue was caught by the new '-Winternal-linkage-in-inline' warning.

llvm-svn: 158798
2012-06-20 08:39:27 +00:00
Nick Kledzik 18497e9242 Add permissions(), map_file_pages(), and unmap_file_pages() to llvm::sys::fs and add unit test. Unix is implemented. Windows side needs to be implemented.
llvm-svn: 158770
2012-06-20 00:28:54 +00:00
Chandler Carruth 198422a475 Fix PR13148, an inf-loop in StringMap.
StringMap suffered from the same bug as DenseMap: when you explicitly
construct it with a small number of buckets, you can arrange for the
tombstone-based growth path to be followed when the number of buckets
was less than '8'. In that case, even with a full map, it would compare
'0' as not less than '0', and refuse to grow the table, leading to
inf-loops trying to find an empty bucket on the next insertion. The fix
is very simple: use '<=' as the comparison. The same fix was applied to
DenseMap as well during its recent refactoring.

Thanks to Alex Bolz for the great report and test case. =]

llvm-svn: 158725
2012-06-19 17:40:35 +00:00