Commit Graph

119293 Commits

Author SHA1 Message Date
Kostya Serebryany db32f967b9 [asan] rely on __has_feature(address_sanitizer) instead of the ADDRESS_SANITIZER macro
llvm-svn: 147297
2011-12-27 21:57:12 +00:00
Rafael Espindola 079354692d PR11642 has been fixed, enable -fvisibility-inlines-hidden everywhere.
llvm-svn: 147296
2011-12-27 21:37:11 +00:00
Rafael Espindola 0b79046c5c Fix the visibility of methods of explicit template instantiation definition
when using -fvisibility-inlines-hidden. This matches gcc's behavior and
documentation.

Fixes PR11642.

llvm-svn: 147295
2011-12-27 21:15:28 +00:00
Benjamin Kramer 46236ee5cf Switch StringMap from an array of structures to a structure of arrays.
- -25% memory usage of the main table on x86_64 (was wasted in struct padding).
- no significant performance change.

llvm-svn: 147294
2011-12-27 20:35:07 +00:00
Kostya Serebryany 1b82c281f3 [asan] make sure frame pointers are not omitted when running asan output tests
llvm-svn: 147293
2011-12-27 19:52:54 +00:00
Nick Lewycky 398255e70c Use false not zero, as a bool.
llvm-svn: 147292
2011-12-27 18:27:22 +00:00
Nick Lewycky a8e84fb56b Turn cos(-x) into cos(x). Patch by Alexander Malyshev!
llvm-svn: 147291
2011-12-27 18:25:50 +00:00
Richard Smith 6e52514c5d constexpr: support for evaluation and codegen of typeid constants.
llvm-svn: 147290
2011-12-27 12:18:28 +00:00
Benjamin Kramer b668401b2e Clean up some Release build warnings.
llvm-svn: 147289
2011-12-27 11:41:05 +00:00
Benjamin Kramer c2c47f90a0 Initialize member that ends up in PCH files.
llvm-svn: 147288
2011-12-27 11:15:04 +00:00
Craig Topper df34d152bd Add handling of x86_avx2_pmovmskb to computeMaskedBitsForTargetNode for consistency. Add comments and an assert for BMI instructions to PerformXorCombine since the enabling of the combine is conditional on it, but the function itself isn't.
llvm-svn: 147287
2011-12-27 06:27:23 +00:00
Nick Lewycky c554a9b58e Teach simplifycfg to recompute branch weights when merging some branches, and
to discard weights when appropriate. Still more to do (and a new TODO), but
it's a start!

llvm-svn: 147286
2011-12-27 04:31:52 +00:00
Nick Lewycky 4c131387c3 Using Inst->setMetadata(..., NULL) should be safe to remove metadata even when
there is non of that type to remove. This fixes a crasher in the particular
case where the instruction has metadata but no metadata storage in the context
(this is only possible if the instruction has !dbg but no other metadata info).

llvm-svn: 147285
2011-12-27 01:17:40 +00:00
Rafael Espindola 2b14b80b60 Fix warning.
llvm-svn: 147284
2011-12-26 23:12:42 +00:00
Eli Friedman e96286cdf2 Make sure DAGCombiner doesn't introduce multiple loads from the same memory location. PR10747, part 2.
llvm-svn: 147283
2011-12-26 22:49:32 +00:00
Eli Friedman 2b081c2c9e Partially revert r147195; lib/Basic/Version.cpp conditionally depends on config.h.
llvm-svn: 147282
2011-12-26 22:43:17 +00:00
Rafael Espindola cde2c8f7d2 Delay checking of typedefs of dependent types. Fixes PR11630.
llvm-svn: 147281
2011-12-26 22:42:47 +00:00
Nick Lewycky 8d302df4a4 Update the branch weight metadata when reversing the order of a branch.
llvm-svn: 147280
2011-12-26 20:54:14 +00:00
Nick Lewycky e87d54c817 Sort includes, canonicalize whitespace, fix typos. No functionality change.
llvm-svn: 147279
2011-12-26 20:37:40 +00:00
Dylan Noblesmith 68207c0b26 driver: fix unused variable warning
from r147218.

llvm-svn: 147278
2011-12-26 19:29:47 +00:00
Benjamin Kramer eed4f2a6c5 Fix potential use after free.
llvm-svn: 147277
2011-12-26 14:18:37 +00:00
NAKAMURA Takumi 9a3f299f0e clang/lib/Headers/CMakeLists.txt: Unbreak cmake build to add bmi2intrin.h since r147275.
llvm-svn: 147276
2011-12-26 03:20:06 +00:00
Craig Topper c334dd68a7 Add BMI2 intrinsics.
llvm-svn: 147275
2011-12-26 02:31:10 +00:00
Nadav Rotem 4c4d254f61 Update the LangRef documentation: the codegen does support this instruction.
llvm-svn: 147274
2011-12-25 21:32:35 +00:00
Richard Smith f0215fe898 Fix constexpr handling to allow 'extern constexpr' variable declarations. We no
longer have access to the source locations we need to produce the
'replace constexpr with const' fixits, so they're gone for now.

llvm-svn: 147273
2011-12-25 21:17:58 +00:00
Nadav Rotem c1faeac410 Fix a typo in the widening of vectors in PromoteIntRes. Patch by Shemer Anat.
llvm-svn: 147272
2011-12-25 20:01:38 +00:00
Richard Smith 771c4a1775 constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.

llvm-svn: 147271
2011-12-25 20:00:17 +00:00
Venkatraman Govindaraju 1fc8263b4d Sparc: Implement emitFrameIndexDebugValue and getDebugValue Location hooks.
llvm-svn: 147269
2011-12-25 18:50:24 +00:00
Craig Topper 03348d09e3 Change LZCNT and BMI tests to check IR instead of X86 assembly.
llvm-svn: 147267
2011-12-25 15:20:31 +00:00
NAKAMURA Takumi dceeeb8918 lib/Headers/CMakeLists.txt: Fix cmake build since r147263, for two missing headers.
llvm-svn: 147266
2011-12-25 12:47:46 +00:00
Craig Topper a06d4a1c40 Add the rest of the BMI intrinsics.
llvm-svn: 147265
2011-12-25 07:27:12 +00:00
Bill Wendling 2990ec6e92 Add braces to remove silly warning.
llvm-svn: 147264
2011-12-25 06:56:22 +00:00
Craig Topper f2855ade2b Add intrinsics for lzcnt and tzcnt instructions.
llvm-svn: 147263
2011-12-25 06:25:37 +00:00
Craig Topper 22967d4a61 Add BMI, BMI2, and LZCNT feature flags to enable adding intrinsics.
llvm-svn: 147262
2011-12-25 05:06:45 +00:00
Rafael Espindola 2d3dac3e87 Remove unused variables.
llvm-svn: 147261
2011-12-25 01:20:19 +00:00
Rafael Espindola 65e025cad5 Remove unused variables.
llvm-svn: 147260
2011-12-25 01:18:52 +00:00
Chandler Carruth 8b7e71ffd6 Add an explicit test that we now fold cttz.i32(..., true) >> 5 -> 0.
This is a result of Benjamin's work on ValueTracking.

llvm-svn: 147259
2011-12-24 22:34:15 +00:00
Richard Smith 966c1fb0c8 Always implicitly declare move assignment operations for dynamic classes, in
case they override virtual functions from a base class. Also fix -print-stats
counting of move assignment/construction.

llvm-svn: 147258
2011-12-24 21:56:24 +00:00
Benjamin Kramer b16bd77bd2 InstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff x is smaller than 2^n and it fuses with a following add.
This was intended to undo the sub canonicalization in cases where it's not profitable, but it also
finds some cases on it's own.

llvm-svn: 147256
2011-12-24 17:31:53 +00:00
Benjamin Kramer 4ee5747fdd ComputeMaskedBits: Make knownzero computation more aggressive for ctlz with undef zero.
unsigned foo(unsigned x) { return 31 - __builtin_clz(x); }
now compiles into a single "bsrl" instruction on x86.

llvm-svn: 147255
2011-12-24 17:31:46 +00:00
Benjamin Kramer 010337c838 InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be smaller than 2^n.
This has the obvious advantage of being commutable and is always a win on x86 because
const - x wastes a register there. On less weird architectures this may lead to
a regression because other arithmetic doesn't fuse with it anymore. I'll address that
problem in a followup.

llvm-svn: 147254
2011-12-24 17:31:38 +00:00
Craig Topper 175543ac78 Add last of the AVX2 intrinsics except for gather.
llvm-svn: 147253
2011-12-24 17:20:15 +00:00
Rafael Espindola a56ab0ede7 Section relative fixups are a coff concept, not a x86 one. Replace the
x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.

llvm-svn: 147252
2011-12-24 14:47:52 +00:00
Chandler Carruth a3d54fe0ae Use standard promotion for i8 CTTZ nodes and i8 CTLZ nodes when the
LZCNT instructions are available. Force promotion to i32 to get
a smaller encoding since the fix-ups necessary are just as complex for
either promoted type

We can't do standard promotion for CTLZ when lowering through BSR
because it results in poor code surrounding the 'xor' at the end of this
instruction. Essentially, if we promote the entire CTLZ node to i32, we
end up doing the xor on a 32-bit CTLZ implementation, and then
subtracting appropriately to get back to an i8 value. Instead, our
custom logic just uses the knowledge of the incoming size to compute
a perfect xor. I'd love to know of a way to fix this, but so far I'm
drawing a blank. I suspect the legalizer could be more clever and/or it
could collude with the DAG combiner, but how... ;]

llvm-svn: 147251
2011-12-24 12:12:34 +00:00
Chandler Carruth 38ce24455d Add systematic testing for cttz as well, and fix the bug I spotted by
inspection earlier.

llvm-svn: 147250
2011-12-24 11:46:10 +00:00
Chandler Carruth 103ca80f59 Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test.
llvm-svn: 147249
2011-12-24 11:26:59 +00:00
Chandler Carruth 44cf07228b Tidy up this rather crufty test. Put the declarations at the top to make
my C-brain happy. Remove the unnecessary bits of pedantic IR fluff like
nounwind. Remove stray uses comments. Name things semantically rather
than tN so that adding a new test in the middle doesn't cause pain, and
so that new tests can be grouped semantically.

This exposes how little systematic testing is going on here. I noticed
this by finding several bugs via inspection and wondering why this test
wasn't catching any of them. =[

llvm-svn: 147248
2011-12-24 11:26:57 +00:00
Benjamin Kramer 767bbe48c1 Chandler fixed this.
llvm-svn: 147247
2011-12-24 11:23:32 +00:00
Chandler Carruth c9fcde2347 Expand more when we have a nice 'tzcnt' instruction, to avoid generating
'bsf' instructions here.

This one is actually debatable to my eyes. It's not clear that any chip
implementing 'tzcnt' would have a slow 'bsf' for any reason, and unless
EFLAGS or a zero input matters, 'tzcnt' is just a longer encoding.
Still, this restores the old behavior with 'tzcnt' enabled for now.

llvm-svn: 147246
2011-12-24 11:11:38 +00:00
Chandler Carruth eeb3a1ce3e Tidy up some of these tests.
llvm-svn: 147245
2011-12-24 11:11:36 +00:00