David Blaikie [Wed, 28 Jan 2015 19:50:09 +0000 (19:50 +0000)]
DebugInfo: Attribute implicit boolean tests to the expression being tested, not to the outer use of that expression.
This is half a fix for a GDB test suite failure that expects to start at
'a' in the following code:
void func(int a)
if (a
&&
b)
...
But instead, without this change, the comparison was assigned to '&&'
(well, worse actually - because there was a chained 'a && b && c' and it
was assigned to the second '&&' because of a recursive application of
this bug) and then the load folded into the comparison so breaking on
the function started at '&&' instead of 'a'.
The other part of this needs to be fixed in LLVM where it's ignoring the
location of the icmp and instead using the location of the branch
instruction.
The fix to the conditional operator is actually a no-op currently,
because the conditional operator's location coincides with 'a' (the
start of the conditional expression) but should probably be '?' instead.
See the FIXME in the test case that mentions the ARCMigration tool
failures when I tried to make that change.
llvm-svn: 227356
Sanjay Patel [Wed, 28 Jan 2015 19:44:21 +0000 (19:44 +0000)]
invert check for less indentation; use local vars to reduce duplication; NFC
llvm-svn: 227355
Kostya Serebryany [Wed, 28 Jan 2015 19:39:18 +0000 (19:39 +0000)]
Add clang-format-fuzzer target
Summary:
This adds clang-format-fuzzer binary,
which depends on the Fuzzer lib,
see http://reviews.llvm.org/D7184
This fuzer has found ~15 bugs so far, and I hope to set up a bot for it.
Test Plan: run on a bot.
Reviewers: samsonov, djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D7202
llvm-svn: 227354
Colin LeMahieu [Wed, 28 Jan 2015 19:39:09 +0000 (19:39 +0000)]
[Hexagon] Updating many V4 intrinsic patterns. Adding missing instruction and deleting unused classes.
llvm-svn: 227353
Chandler Carruth [Wed, 28 Jan 2015 19:29:22 +0000 (19:29 +0000)]
[LPM] Try to work around a bug with local-dynamic TLS on PowerPC 64.
Sadly, this precludes optimizing it down to initial-exec or local-exec
when statically linking, and in general makes the code slower on PPC 64,
but there's nothing else for it until we can arrange to produce the
correct bits for the linker.
Lots of thanks to Ulirch for tracking this down and Bill for working on
the long-term fix to LLVM so that we can relegate this to old host
clang versions.
I'll be watching the PPC build bots to make sure this effectively
revives them.
llvm-svn: 227352
Philip Reames [Wed, 28 Jan 2015 19:28:03 +0000 (19:28 +0000)]
Remove gc.root's performCustomLowering
This is a refactoring to restructure the single user of performCustomLowering as a specific lowering pass and remove the custom lowering hook entirely.
Before this change, the LowerIntrinsics pass (note to self: rename!) was essentially acting as a pass manager, but without being structured in terms of passes. Instead, it proxied calls to a set of GCStrategies internally. This adds a lot of conceptual complexity (i.e. GCStrategies are stateful!) for very little benefit. Since there's been interest in keeping the ShadowStackGC working, I extracting it's custom lowering pass into a dedicated pass and just added that to the pass order. It will only run for functions which opt-in to that gc.
I wasn't able to find an easy way to preserve the runtime registration of custom lowering functionality. Given that no user of this exists that I'm aware of, I made the choice to just remove that. If someone really cares, we can look at restoring it via dynamic pass registration in the future.
Note that despite the large diff, none of the lowering code actual changes. I added the framing needed to make it a pass and rename the class, but that's it.
Differential Revision: http://reviews.llvm.org/D7218
llvm-svn: 227351
Enrico Granata [Wed, 28 Jan 2015 19:23:51 +0000 (19:23 +0000)]
Harden against the process pointer being null - this seems like it shouldn't happen, except it did - by a user stopping the debugger while the variables view was refreshing
Fixes rdar://
19599357
llvm-svn: 227350
Chris Bieneman [Wed, 28 Jan 2015 19:17:09 +0000 (19:17 +0000)]
Moving AddLiteralOption's declaration higher up in the header to make gcc happy.
llvm-svn: 227348
Colin LeMahieu [Wed, 28 Jan 2015 19:16:17 +0000 (19:16 +0000)]
[Hexagon] Adding XTYPE/MPY intrinsic tests and some missing multiply instructions.
llvm-svn: 227347
Chris Bieneman [Wed, 28 Jan 2015 19:00:25 +0000 (19:00 +0000)]
Refactoring llvm command line parsing and option registration.
Summary:
The primary goal of this patch is to remove the need for MarkOptionsChanged(). That goal is accomplished by having addOption and removeOption properly sort the options.
This patch puts the new add and remove functionality on a CommandLineParser class that is a placeholder. Some of the functionality in this class will need to be merged into the OptionRegistry, and other bits can hopefully be in a better abstraction.
This patch also removes the RegisteredOptionList global, and the need for cl::Option objects to be linked list nodes.
The changes in CommandLineTest.cpp are required because these changes shift when we validate that options are not duplicated. Before this change duplicate options were only found during certain cl API calls (like cl::ParseCommandLine). With this change duplicate options are found during option construction.
Reviewers: dexonsmith, chandlerc, pete
Reviewed By: pete
Subscribers: pete, majnemer, llvm-commits
Differential Revision: http://reviews.llvm.org/D7132
llvm-svn: 227345
Filipe Cabecinhas [Wed, 28 Jan 2015 18:49:45 +0000 (18:49 +0000)]
Testcase for PS4 target defaults (from r227215 and r227219)
llvm-svn: 227343
Enrico Granata [Wed, 28 Jan 2015 18:45:28 +0000 (18:45 +0000)]
As promised, make this more efficient by only doing all the busy work when necessary
llvm-svn: 227342
Rui Ueyama [Wed, 28 Jan 2015 18:38:50 +0000 (18:38 +0000)]
Add a unit test for LinkerScript.
llvm-svn: 227341
Alex Rosenberg [Wed, 28 Jan 2015 18:33:39 +0000 (18:33 +0000)]
Assume code ownership for the PS4 to ensure patches get reviewed, per the Developer Policy.
llvm-svn: 227340
Bjorn Steinbrink [Wed, 28 Jan 2015 18:32:31 +0000 (18:32 +0000)]
Fix build breakage caused by memory leaks in llvm-c-test
I accidently introduced those in r227319.
llvm-svn: 227339
Colin LeMahieu [Wed, 28 Jan 2015 18:29:11 +0000 (18:29 +0000)]
[Hexagon] Deleting a lot of old variants of intrinsics and updating references.
llvm-svn: 227338
Frederic Riss [Wed, 28 Jan 2015 18:27:01 +0000 (18:27 +0000)]
[dsymutil] Add DwarfLinker class.
It's an empty shell for now. It's main method just opens the debug
map objects and parses their Dwarf info. Test that we at least do
that correctly.
llvm-svn: 227337
Alex Rosenberg [Wed, 28 Jan 2015 18:26:15 +0000 (18:26 +0000)]
Enable pragma comment processing for PS4. Original patch by Yunzhong Gao!
llvm-svn: 227336
Colin LeMahieu [Wed, 28 Jan 2015 18:06:23 +0000 (18:06 +0000)]
[Hexagon] Converting XTYPE/BIT intrinsic patterns and adding tests.
llvm-svn: 227335
Sanjay Patel [Wed, 28 Jan 2015 18:01:31 +0000 (18:01 +0000)]
use SDValue methods directly instead of getNode()->* ; NFCI
llvm-svn: 227334
Rafael Espindola [Wed, 28 Jan 2015 17:54:19 +0000 (17:54 +0000)]
Simplify code. NFC.
llvm-svn: 227333
Colin LeMahieu [Wed, 28 Jan 2015 17:37:59 +0000 (17:37 +0000)]
[Hexagon] Replacing XTYPE/SHIFT intrinsic patternss. Adding tests and missing instructions with tests.
llvm-svn: 227330
Oleksiy Vyalov [Wed, 28 Jan 2015 17:36:59 +0000 (17:36 +0000)]
Launch lldb-gdbserver in same process group when launched remotely using lldb-platform - commit on behalf of flackr.
http://reviews.llvm.org/D7211
llvm-svn: 227329
Nico Weber [Wed, 28 Jan 2015 17:29:57 +0000 (17:29 +0000)]
Fix indents on asan_symbolize.py's argument parsing code. No behavior change.
llvm-svn: 227327
Nico Weber [Wed, 28 Jan 2015 17:28:04 +0000 (17:28 +0000)]
Make asan_symbolize.py not crash on Windows.
asan_symbolize.py isn't needed on Windows, but it's nice if asan has a unified
UI on all platforms. So rather than have asan_symolize.py die on startup due to
it importing modules that don't exist on Windows, let it just echo the input.
llvm-svn: 227326
Jozef Kolek [Wed, 28 Jan 2015 17:27:26 +0000 (17:27 +0000)]
[mips][microMIPS] Implement LWGP instruction
Differential Revision: http://reviews.llvm.org/D6650
llvm-svn: 227325
Colin LeMahieu [Wed, 28 Jan 2015 17:06:40 +0000 (17:06 +0000)]
[Hexagon] Replacing intrinsics for halfword adds and max/min word/dword.
llvm-svn: 227322
Colin LeMahieu [Wed, 28 Jan 2015 16:58:05 +0000 (16:58 +0000)]
[Hexagon] Replacing old intrinsic tests with organized versions that match the reference manual.
llvm-svn: 227321
Greg Fitzgerald [Wed, 28 Jan 2015 16:37:43 +0000 (16:37 +0000)]
Remove PPC ELF target
Differential Revision: http://reviews.llvm.org/D7225
llvm-svn: 227320
Bjorn Steinbrink [Wed, 28 Jan 2015 16:35:59 +0000 (16:35 +0000)]
Fix LLVMSetMetadata and LLVMAddNamedMetadataOperand for single value MDNodes
Summary:
MetadataAsValue uses a canonical format that strips the MDNode if it
contains only a single constant value. This triggers an assertion when
trying to cast the value to a MDNode.
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7165
llvm-svn: 227319
Simon Atanasyan [Wed, 28 Jan 2015 16:22:50 +0000 (16:22 +0000)]
[ELFYAML] Provide explicit value for relocation addendums in the test
The `Addend` is an optional field of the `Relocation` YAML record. But
we do not provide its default value while reading it from a YAML file
and so it might keep uninitialized.
I am going to fix the code by a separate commit. We might either make
this field mandatory (at least for .rela sections) or specify 0 as
a default value explicitly.
llvm-svn: 227318
Michael Kuperstein [Wed, 28 Jan 2015 16:11:35 +0000 (16:11 +0000)]
[x32] Change the condition from bitness to LP64 for TCRETURNdi64.
TCRETURNmi64, which was mistakenly changed in r227307 will wait for another day.
llvm-svn: 227317
Tom Stellard [Wed, 28 Jan 2015 16:04:26 +0000 (16:04 +0000)]
R600: Move DataLayout to AMDGPUTargetMachine
This is a follow up to r227113.
It is now required to use the amdgcn target for SI and newer GPUs.
llvm-svn: 227316
Tom Stellard [Wed, 28 Jan 2015 15:38:44 +0000 (15:38 +0000)]
R600: Use a Southern Islands GPU as the default for the amdgcn target
llvm-svn: 227315
Tom Stellard [Wed, 28 Jan 2015 15:38:42 +0000 (15:38 +0000)]
R600: Use a Southern Islands GPU as the default for the amdgcn target
llvm-svn: 227314
Hal Finkel [Wed, 28 Jan 2015 15:11:18 +0000 (15:11 +0000)]
Fix typo (count correctly) in include/clang/AST/TypeNodes.def
Patch by Mingjie Xing.
llvm-svn: 227313
Nathan Sidwell [Wed, 28 Jan 2015 14:48:39 +0000 (14:48 +0000)]
PR 20146
make new diagnostic an ExtWarn
llvm-svn: 227312
Hal Finkel [Wed, 28 Jan 2015 14:44:14 +0000 (14:44 +0000)]
Correct the AggressiveAntiDepBreaker's handling of subregisters defining super registers
As the AggressiveAntiDepBreaker iterated backward through a scheduling region,
we must leave super registers live through subregister definitions so that all
relevant subregister definitions are renamed together. The problem was that we
were also discarding sub-register use locations as the sub-registers are
redefined. The result is that we'd rename the super register along with some,
but not all, subregister definitions.
R0_D = {R0_L, R1_L}
R0_L = {R0_S, R1_S}
%R0_L<def> = TRLi9 16, pred:8, pred:%noreg
%R1_L<def> = LSRLrr %R1_L<kill>, %R0_S, pred:8, pred:%noreg
%R0_L<def> = LSRLrr %R2_L, %R0_S, pred:8, pred:%noreg, %R0_L<imp-use,kill>
%R1_L<def> = ANDLri %R1_L<kill>, 2047, pred:8, pred:%noreg
%R0_L<def> = ANDLri %R0_L<kill>, 2047, pred:8, pred:%noreg
%R4_D<def> = ASRDrr %R0_D<kill>, %R6_S
Anti: %R4_D<def> = ASRDrr %R0_D<kill>, %R6_S
Def Groups: R4_D=g213->g215(via R4_S)->g214(via R4_L)->g216(via R5_S)->g216(via R4_L)->g217(via R5_L)
Use Groups: R0_D=g0->g218(last-use) R1_L->g219(last-use) R6_S=g204->g220(last-use)
Anti: %R0_L<def> = ANDLri %R0_L<kill>, 2047, pred:8, pred:%noreg
Def Groups: R0_L=g208->g209(via R0_S)->g218(via R0_D)->g210(via R1_S)->g210(via R0_D)
Antidep reg: R0_L (real dependency)
Use Groups: R0_L=g210->g224(last-use) R0_S->g225(last-use) R1_S->g226(last-use)
Anti: %R1_L<def> = ANDLri %R1_L<kill>, 2047, pred:8, pred:%noreg
Def Groups: R1_L=g219->g210(via R0_D)
Antidep reg: R1_L (real dependency)
Use Groups: R1_L=g210->g229(last-use)
Anti: %R0_L<def> = LSRLrr %R2_L, %R0_S, pred:8, pred:%noreg, %R0_L<imp-use,kill>
Def Groups: R0_L=g224->g225(via R0_S)->g210(via R0_D)->g226(via R1_S)->g226(via R0_D)
Antidep reg: R0_L Use Groups: R2_L=g192 R0_S=g226->g230(last-use) R0_L=g226->g231(last-use) R1_S->g232(last-use)
Anti: %R1_L<def> = LSRLrr %R1_L<kill>, %R0_S, pred:8, pred:%noreg
Def Groups: R1_L=g229->g226(via R0_D)
Antidep reg: R1_L Use Groups: R1_L=g226->g233(last-use) R0_S=g230
Anti: %R0_L<def> = TRLi9 16, pred:8, pred:%noreg
Def Groups: R0_L=g231->g230(via R0_S)->g226(via R0_D)->g232(via R1_S)->g232(via R0_D)
Antidep reg: R0_L
Rename Candidates for Group g232:
R0_D: elcInt64Regs :: R0_D R1_D R2_D R3_D R4_D R5_D R8_D R9_D R10_D R11_D R12_D R13_D R14_D R15_D R16_D R17_D R18_D R19_D R20_D R21_D R22_D R23_D R24_D R25_D
R0_L: elcIntRegs :: R0_L R1_L R2_L R3_L R4_L R5_L R8_L R9_L R10_L R11_L R12_L R13_L R14_L R15_L R16_L R17_L R18_L R19_L R20_L R21_L R22_L R23_L R24_L R25_L
R0_S: elcShrtRegs elcShrtRegs :: R0_S R1_S R2_S R3_S R4_S R5_S R8_S R9_S R10_S R11_S R12_S R13_S R14_S R15_S R16_S R17_S R18_S R19_S R20_S R21_S R22_S R23_S R24_S R25_S
Find Registers: [R12_D: R12_D R12_L R12_S]
Breaking anti-dependence edge on R0_L: R0_D->R12_D(1 refs) R0_L->R12_L(2 refs) R0_S->R12_S(2 refs)
Use Groups:
...
%R12_L<def> = TRLi9 16, pred:8, pred:%noreg
%R1_L<def> = LSRLrr %R1_L<kill>, %R12_S, pred:8, pred:%noreg
%R0_L<def> = LSRLrr %R2_L<kill>, %R12_S, pred:8, pred:%noreg, %R12_L<imp-use>
%R1_L<def> = ANDLri %R1_L<kill>, 2047, pred:8, pred:%noreg
%R0_L<def> = ANDLri %R0_L<kill>, 2047, pred:8, pred:%noreg
%R4_D<def> = ASRDrr %R12_D<kill>, %R6_S
With this change, we now produce:
Anti: %R4_D<def> = ASRDrr %R0_D<kill>, %R6_S
Def Groups: R4_D=g213->g215(via R4_S)->g214(via R4_L)->g216(via R5_S)->g216(via R4_L)->g217(via R5_L)
Use Groups: R0_D=g0->g218(last-use) R1_L->g219(last-use) R6_S=g204->g220(last-use)
Anti: %R0_L<def> = ANDLri %R0_L<kill>, 2047, pred:8, pred:%noreg
Def Groups: R0_L=g208->g209(via R0_S)->g218(via R0_D)->g210(via R1_S)->g210(via R0_D)
Antidep reg: R0_L (real dependency)
Use Groups: R0_L=g210
Anti: %R1_L<def> = ANDLri %R1_L<kill>, 2047, pred:8, pred:%noreg
Def Groups: R1_L=g219->g210(via R0_D)
Antidep reg: R1_L (real dependency)
Use Groups: R1_L=g210
Anti: %R0_L<def> = LSRLrr %R2_L, %R0_S, pred:8, pred:%noreg, %R0_L<imp-use,kill>
Def Groups: R0_L=g210->g210(via R0_D)->g210(via R0_D)
Antidep reg: R0_L Use Groups: R2_L=g192 R0_S=g210 R0_L=g210
Anti: %R1_L<def> = LSRLrr %R1_L<kill>, %R0_S, pred:8, pred:%noreg
Def Groups: R1_L=g210->g210(via R0_D)
Antidep reg: R1_L Use Groups: R1_L=g210 R0_S=g210
Anti: %R0_L<def> = TRLi9 16, pred:8, pred:%noreg
Def Groups: R0_L=g210->g210(via R0_D)->g210(via R0_D)
Antidep reg: R0_L
Rename Candidates for Group g210:
R0_D: elcInt64Regs :: R0_D R1_D R2_D R3_D R4_D R5_D R8_D R9_D R10_D R11_D R12_D R13_D R14_D R15_D R16_D R17_D R18_D R19_D R20_D R21_D R22_D R23_D R24_D R25_D
R0_L: elcIntRegs elcIntAIRegs elcIntRegs elcIntRegs elcIntRegs elcIntRegs :: R0_L R1_L R2_L R3_L R4_L R5_L R8_L R9_L R10_L R11_L R12_L R13_L R14_L R15_L R16_L R17_L R18_L R19_L R20_L R21_L R22_L R23_L R24_L R25_L
R1_L: elcIntRegs elcIntRegs elcIntRegs elcIntRegs elcIntRegs :: R0_L R1_L R2_L R3_L R4_L R5_L R8_L R9_L R10_L R11_L R12_L R13_L R14_L R15_L R16_L R17_L R18_L R19_L R20_L R21_L R22_L R23_L R24_L R25_L
R0_S: elcShrtRegs elcShrtRegs :: R0_S R1_S R2_S R3_S R4_S R5_S R8_S R9_S R10_S R11_S R12_S R13_S R14_S R15_S R16_S R17_S R18_S R19_S R20_S R21_S R22_S R23_S R24_S R25_S
Find Registers: [R12_D: R12_D R12_L R13_L R12_S]
Breaking anti-dependence edge on R0_L: R0_D->R12_D(1 refs) R0_L->R12_L(7 refs) R1_L->R13_L(5 refs) R0_S->R12_S(2 refs)
Use Groups:
...
%R12_L<def> = TRLi9 16, pred:8, pred:%noreg
%R13_L<def> = LSRLrr %R13_L<kill>, %R12_S, pred:8, pred:%noreg
%R12_L<def> = LSRLrr %R2_L<kill>, %R12_S<kill>, pred:8, pred:%noreg, %R12_L<imp-use,kill>
%R13_L<def> = ANDLri %R13_L<kill>, 2047, pred:8, pred:%noreg
%R12_L<def> = ANDLri %R12_L<kill>, 2047, pred:8, pred:%noreg
%R4_D<def> = ASRDrr %R12_D, %R6_S, %R12_L<imp-def>, %R12_S<imp-def>, %R13_S<imp-def>
As demonstrated by this example, this is also somewhat unfortunate, because
there is actually no need to rename the super register in this case (it is
fully covered by later subregister definitions), but we don't seem to track
enough information here to exploit that either.
Thanks to Daniil Troshkov for reporting the issue. The debug outputs in this
commit message are from Daniil.
llvm-svn: 227311
Sean Silva [Wed, 28 Jan 2015 14:19:08 +0000 (14:19 +0000)]
Avoid testing for a particular choice of resource dir.
Without this patch, this test was accidentally testing that
CLANG_RESOURCE_DIR, CLANG_LIBDIR_SUFFIX, and CLANG_VERSION_STRING
were set to a particular set of values.
The test was also getting pretty hairy since it was attempting to craft
a regular expression that covered "all" possible combinations of
settings for these configure-time constants.
Clean it up by directly capturing the resource directory in a FileCheck
variable.
llvm-svn: 227310
Francisco Lopes da Silva [Wed, 28 Jan 2015 14:17:22 +0000 (14:17 +0000)]
Improves overload completion result chunks.
The code building the code completion string for overloads was providing
less detail compared to the one building completion strings for function
declarations. There was no information about optionals and no information
about what's a parameter and what's a function identifier, everything
besides ResultType, CurrentParameter and special characters was classified
as Text.
This makes code completion strings for overload candidates to follow a
pattern very similar, but not identical, to the one in use for function
declarations:
- return type chunk: ResultType
- function identifier chunk: Text
- parameter chunks: Placeholder
- optional parameter chunks: Optional
- current parameter chunk: CurrentParameter
llvm-svn: 227309
Michael Kuperstein [Wed, 28 Jan 2015 14:08:22 +0000 (14:08 +0000)]
[X86] Reduce some 32-bit imuls into lea + shl
Reduce integer multiplication by a constant of the form k*2^c, where k is in {3,5,9} into a lea + shl. Previously it was only done for imulq on 64-bit platforms, but it makes sense for imull and 32-bit as well.
Differential Revision: http://reviews.llvm.org/D7196
llvm-svn: 227308
Michael Kuperstein [Wed, 28 Jan 2015 13:38:48 +0000 (13:38 +0000)]
[x32] Enable sibcall optimization on x32.
This includes two things:
1) Fix TCRETURNdi and TCRETURN64di patterns to check the right thing (LP64 as opposed to target bitness).
2) Allow LEA64_32 in MatchingStackOffset.
llvm-svn: 227307
Sean Silva [Wed, 28 Jan 2015 10:36:41 +0000 (10:36 +0000)]
[docs] Use slightly more proper .rst markup
Again, I'd like to emphasize to everyone that this sort of markup change
is *not* what you should be concerned about when writing docs. Focus on
*content*.
I applaud Chandler for focusing on the fantastic content of this new
section!
llvm-svn: 227305
Sean Silva [Wed, 28 Jan 2015 10:26:29 +0000 (10:26 +0000)]
[docs] [cleanup] No need for a comment around C++11 override
llvm-svn: 227304
Elena Demikhovsky [Wed, 28 Jan 2015 10:21:27 +0000 (10:21 +0000)]
AVX-512: Added FMA intrinsics with rounding mode
By Asaf Badouh and Elena Demikhovsky
Added special nodes for rounding: FMADD_RND, FMSUB_RND..
It will prevent merge between nodes with rounding and other standard nodes.
llvm-svn: 227303
Craig Topper [Wed, 28 Jan 2015 10:09:56 +0000 (10:09 +0000)]
[X86] Teach disassembler to handle illegal immediates on AVX512 integer compare instructions.
llvm-svn: 227302
Craig Topper [Wed, 28 Jan 2015 10:09:52 +0000 (10:09 +0000)]
[X86] Merge printSSECC and printAVXCC. They only differed by an assertion.
llvm-svn: 227301
Chandler Carruth [Wed, 28 Jan 2015 09:52:14 +0000 (09:52 +0000)]
[LPM] Rip all of ManagedStatic and ThreadLocal out of the pretty stack
tracing code.
Managed static was just insane overhead for this. We took memory fences
and external function calls in every path that pushed a pretty stack
frame. This includes a multitude of layers setting up and tearing down
passes, the parser in Clang, everywhere. For the regression test suite
or low-overhead JITs, this was contributing to really significant
overhead.
Even the LLVM ThreadLocal is really overkill here because it uses
pthread_{set,get}_specific logic, and has careful code to both allocate
and delete the thread local data. We don't actually want any of that,
and this code in particular has problems coping with deallocation. What
we want is a single TLS pointer that is valid to use during global
construction and during global destruction, any time we want. That is
exactly what every host compiler and OS we use has implemented for
a long time, and what was standardized in C++11. Even though not all of
our host compilers support the thread_local keyword, we can directly use
the platform-specific keywords to get the minimal functionality needed.
Provided this limited trial survives the build bots, I will move this to
Compiler.h so it is more widely available as a light weight if limited
alternative to the ThreadLocal class. Many thanks to David Majnemer for
helping me think through the implications across platforms and craft the
MSVC-compatible syntax.
The end result is *substantially* faster. When running llc in a tight
loop over a small IR file targeting the aarch64 backend, this improves
its performance by over 10% for me. It also seems likely to fix the
remaining regressions seen by JIT users with threading enabled.
This may actually have more impact on real-world compile times due to
the use of the pretty stack tracing utility throughout the rest of Clang
or LLVM, but I've not collected any detailed measurements.
llvm-svn: 227300
Chandler Carruth [Wed, 28 Jan 2015 09:47:21 +0000 (09:47 +0000)]
[LPM] A targeted but somewhat horrible fix to the legacy pass manager's
querying of the pass registry.
The pass manager relies on the static registry of PassInfo objects to
perform all manner of its functionality. I don't understand why it does
much of this. My very vague understanding is that this registry is
touched both during static initialization *and* while each pass is being
constructed. As a consequence it is hard to make accessing it not
require a acquiring some lock. This lock ends up in the hot path of
setting up, tearing down, and invaliditing analyses in the legacy pass
manager.
On most systems you can observe this as a non-trivial % of the time
spent in 'ninja check-llvm'. However, I haven't really seen it be more
than 1% in extreme cases of compiling more real-world software,
including LTO.
Unfortunately, some of the GPU JITs are seeing this taking essentially
all of their time because they have very small IR running through
a small pass pipeline very many times (at least, this is the vague
understanding I have of it).
This patch tries to minimize the cost of looking up PassInfo objects by
leveraging the fact that the objects themselves are immutable and they
are allocated separately on the heap and so don't have their address
change. It also requires a change I made the last time I tried to debug
this problem which removed the ability to de-register a pass from the
registry. This patch creates a single access path to these objects
inside the PMTopLevelManager which memoizes the result of querying the
registry. This is somewhat gross as I don't really know if
PMTopLevelManager is the *right* place to put it, and I dislike using
a mutable member to memoize things, but it seems to work.
For long-lived pass managers this should completely eliminate
the cost of acquiring locks to look into the pass registry once the
memoized cache is warm. For 'ninja check' I measured about 1.5%
reduction in CPU time and in total time on a machine with 32 hardware
threads. For normal compilation, I don't know how much this will help,
sadly. We will still pay the cost while we populate the memoized cache.
I don't think it will hurt though, and for LTO or compiles with many
small functions it should still be a win. However, for tight loops
around a pass manager with many passes and small modules, this will help
tremendously. On the AArch64 backend I saw nearly 50% reductions in time
to complete 2000 cycles of spinning up and tearing down the pipeline.
Measurements from Owen of an actual long-lived pass manager show more
along the lines of 10% improvements.
Differential Revision: http://reviews.llvm.org/D7213
llvm-svn: 227299
Elena Demikhovsky [Wed, 28 Jan 2015 08:03:58 +0000 (08:03 +0000)]
Fold fcmp in cases where value is provably non-negative. By Arch Robison.
This patch folds fcmp in some cases of interest in Julia. The patch adds a function CannotBeOrderedLessThanZero that returns true if a value is provably not less than zero. I.e. the function returns true if the value is provably -0, +0, positive, or a NaN. The patch extends InstructionSimplify.cpp to fold instances of fcmp where:
- the predicate is olt or uge
- the first operand is provably not less than zero
- the second operand is zero
The motivation for handling these cases optimizing away domain checks for sqrt in Julia for common idioms such as sqrt(x*x+y*y)..
http://reviews.llvm.org/D6972
llvm-svn: 227298
Simon Atanasyan [Wed, 28 Jan 2015 06:23:15 +0000 (06:23 +0000)]
[Mips] Fix enumeral and non-enumeral type in conditional expression warning
No functional changes.
llvm-svn: 227297
David Majnemer [Wed, 28 Jan 2015 06:00:01 +0000 (06:00 +0000)]
llvm-ar: Remove unimplemented -N option from -help
This fixes PR22358.
llvm-svn: 227296
David Majnemer [Wed, 28 Jan 2015 05:48:06 +0000 (05:48 +0000)]
Sema: Ensure that __c11_atomic_fetch_add has a pointer to complete type
Pointer arithmetic is only makes sense if the pointee type is complete.
This fixes PR22361.
llvm-svn: 227295
Chandler Carruth [Wed, 28 Jan 2015 04:57:56 +0000 (04:57 +0000)]
[LPM] Stop using the string based preservation API. It is an
abomination.
For starters, this API is incredibly slow. In order to lookup the name
of a pass it must take a memory fence to acquire a pointer to the
managed static pass registry, and then potentially acquire locks while
it consults this registry for information about what passes exist by
that name. This stops the world of LLVMs in your process no matter
how little they cared about the result.
To make this more joyful, you'll note that we are preserving many passes
which *do not exist* any more, or are not even analyses which one might
wish to have be preserved. This means we do all the work only to say
"nope" with no error to the user.
String-based APIs are a *bad idea*. String-based APIs that cannot
produce any meaningful error are an even worse idea. =/
I have a patch that simply removes this API completely, but I'm hesitant
to commit it as I don't really want to perniciously break out-of-tree
users of the old pass manager. I'd rather they just have to migrate to
the new one at some point. If others disagree and would like me to kill
it with fire, just say the word. =]
llvm-svn: 227294
Eric Christopher [Wed, 28 Jan 2015 03:51:33 +0000 (03:51 +0000)]
Migrate AArch64 except for TTI and AsmPrinter away from getSubtargetImpl.
llvm-svn: 227293
Chandler Carruth [Wed, 28 Jan 2015 03:04:54 +0000 (03:04 +0000)]
Introduce a section to the programmers manual about type hierarchies,
polymorphism, and virtual dispatch.
This is essentially trying to explain the emerging design techniques
being used in LLVM these days somewhere more accessible than the
comments on a particular piece of infrastructure. It covers the
"concepts-based polymorphism" that caused some confusion during initial
reviews of the new pass manager as well as the tagged-dispatch mechanism
used pervasively in LLVM and Clang.
Perhaps most notably, I've tried to provide some criteria to help
developers choose between these options when designing new pieces of
infrastructure.
Differential Revision: http://reviews.llvm.org/D7191
llvm-svn: 227292
David Blaikie [Wed, 28 Jan 2015 02:43:15 +0000 (02:43 +0000)]
Add description to assert
llvm-svn: 227291
David Blaikie [Wed, 28 Jan 2015 02:34:53 +0000 (02:34 +0000)]
PR22356: DebugInfo: Handle the size of a member where the type of that member is a typedef (or other sugar) of a declaration.
llvm-svn: 227290
Enrico Granata [Wed, 28 Jan 2015 01:41:00 +0000 (01:41 +0000)]
Emit a warning the first time that one tries to resolve the size of a type passing a nullptr ExecutionContext - but only when it might actually make a difference
This should help us find these cases and act on them
llvm-svn: 227289
Greg Clayton [Wed, 28 Jan 2015 01:33:37 +0000 (01:33 +0000)]
Changes in 226712 needed some fixing as a platform is almost always selected and even if platform options are specified when doing a "target create" they would get ignored if a platform was already selected.
The change was made so we could re-use a platform if one was already created instead of creating a new one, but it would fail in the above case. To fix this, if we have a selected platform, we verify that the platform matches the current platform before we try to re-use it. We do this by asking the OptionGroupPlatform if the platform matches. If so, it returns true and we don't create a new platform, else we do.
llvm-svn: 227288
Lang Hames [Wed, 28 Jan 2015 01:30:37 +0000 (01:30 +0000)]
Revert r227247 and r227228: "Add weak symbol support to RuntimeDyld".
This has wider implications than I expected when I reviewed the patch: It can
cause JIT crashes where clients have used the default value for AbortOnFailure
during symbol lookup. I'm currently investigating alternative approaches and I
hope to have this back in tree soon.
llvm-svn: 227287
Zachary Turner [Wed, 28 Jan 2015 01:22:33 +0000 (01:22 +0000)]
[llvm-pdbdump] Add basic symbol dumping.
This adds two command line options:
--symbols dumps a list of all symbols found in the PDB.
--symbol-details dumps the same list, but with detailed information
for every symbol such as type, attributes, etc.
llvm-svn: 227286
Jim Ingham [Wed, 28 Jan 2015 01:18:01 +0000 (01:18 +0000)]
SBThread::GetDescription should use the Thread format instead of making up
some format of its own.
llvm-svn: 227285
Reid Kleckner [Wed, 28 Jan 2015 01:17:38 +0000 (01:17 +0000)]
Move EH personality type classification to Analysis/LibCallSemantics.h
Summary:
Also add enum types for __C_specific_handler and _CxxFrameHandler3 for
which we know a few things.
Reviewers: majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7214
llvm-svn: 227284
Jim Ingham [Wed, 28 Jan 2015 01:17:26 +0000 (01:17 +0000)]
Use LLDB_INVALID_FRAME_ID for invalid frame ID's.
llvm-svn: 227283
Enrico Granata [Wed, 28 Jan 2015 01:09:45 +0000 (01:09 +0000)]
Move several GetByteSize() calls over to the brave new world of taking an ExecutionContext*
And since enough of these are doing the right thing, add a test case to verify we are doing the right thing with freeze drying ObjC object types
Fixes rdar://
18092770
llvm-svn: 227282
Greg Clayton [Wed, 28 Jan 2015 01:08:39 +0000 (01:08 +0000)]
If we say:
(lldb) b isEqual:
We end up calling "breakpoint set --name "isEqual:" and it was not checking for selectors due to a logic error.
llvm-svn: 227281
Larisse Voufo [Wed, 28 Jan 2015 01:01:21 +0000 (01:01 +0000)]
Re-arrange DR test cases, and update DR status page.
llvm-svn: 227279
Kaelyn Takata [Wed, 28 Jan 2015 00:46:09 +0000 (00:46 +0000)]
Use the real CXXScopeSpec when setting the correction SourceRange.
Otherwise, in the most important case and the only case where SS and
TempSS are different (which is when the CXXScopeSpec should be dropped,
and TempSS is NULL) the wrong SourceRange will be used in the fixit for
the typo correction. Fixes the remaining issue in PR20626.
llvm-svn: 227278
Enrico Granata [Wed, 28 Jan 2015 00:45:42 +0000 (00:45 +0000)]
More work for the dynamic type size feature
Namely, this commit provides an actual implementation of how to retrieve the byte size in a sane way for an ObjC class, by scanning ivar offsets and byte sizes, figuring out the farthest-from-base ivar, and adding its byte size to that
Still NFC
llvm-svn: 227277
Zachary Turner [Wed, 28 Jan 2015 00:33:00 +0000 (00:33 +0000)]
[llvm-pdbdump] Add support for printing source files and compilands.
This adds two command line options to llvm-pdbdump.
--source-files prints a flat list of all source files in the PDB.
--compilands prints a list of all compilands (e.g. object files)
that the PDB knows about, and for each one, a list of
source files that the compiland is composed of as well
as a hash of the original source file.
llvm-svn: 227276
Zachary Turner [Wed, 28 Jan 2015 00:32:49 +0000 (00:32 +0000)]
[llvm-pdbdump] Print more friendly names for enum values.
llvm-svn: 227275
Enrico Granata [Wed, 28 Jan 2015 00:07:51 +0000 (00:07 +0000)]
Preparatory infrastructural work to support dynamically determining sizes of ObjC types via the runtime
This is necessary because the byte size of an ObjC class type is not reliably statically knowable (e.g. because superclasses sit deep in frameworks that we have no debug info for)
The lack of reliable size info is a problem when trying to freeze-dry an ObjC instance (not the pointer, the pointee)
This commit lays the foundation for having language runtimes help in figuring out byte sizes, and having ClangASTType ask for runtime help
No feature change as no runtime actually implements the logic, and nowhere is an ExecutionContext passed in yet
llvm-svn: 227274
Eric Fiselier [Wed, 28 Jan 2015 00:05:48 +0000 (00:05 +0000)]
Fix flag order of -xc++ in CXXCompiler.
llvm-svn: 227273
Quentin Colombet [Tue, 27 Jan 2015 23:58:01 +0000 (23:58 +0000)]
Revert r227242 - Merge vector stores into wider vector stores (PR21711).
This commit creates infinite loop in DAG combine for in the LLVM test-suite
for aarch64 with mcpu=cylcone (just having neon may be enough to expose this).
llvm-svn: 227272
Greg Clayton [Tue, 27 Jan 2015 23:45:56 +0000 (23:45 +0000)]
Added test case to make sure we don't regress on settings breakpoints by selector and with the various partially specified ObjC specified breakpoints.
This test tests the equivalent of:
breakpoint set --name count
breakpoint set --selector count
breakpoint set --name isEqual:
breakpoint set --selector isEqual:
breakpoint set --name "-[MyClass(MyCategory) myCategoryFunction]"
breakpoint set --name "-[MyClass myCategoryFunction]"
breakpoint set --name "[MyClass myCategoryFunction]"
llvm-svn: 227271
Hans Wennborg [Tue, 27 Jan 2015 23:34:35 +0000 (23:34 +0000)]
Intrin.h: define _XCR_XFEATURE_ENABLED_MASK
Users expect to be able to use this with _xgetbv.
llvm-svn: 227270
Petar Jovanovic [Tue, 27 Jan 2015 23:30:18 +0000 (23:30 +0000)]
[mips] Use __clear_cache builtin instead of cacheflush()
Use __clear_cache builtin instead of cacheflush() in
Unix Memory::InvalidateInstructionCache().
Differential Revision: http://reviews.llvm.org/D7198
llvm-svn: 227269
Enrico Granata [Tue, 27 Jan 2015 23:26:59 +0000 (23:26 +0000)]
Fix a typo in code-signing.txt
llvm-svn: 227268
Richard Smith [Tue, 27 Jan 2015 23:23:39 +0000 (23:23 +0000)]
Cleanups, and add some FIXMEs. No functional change.
llvm-svn: 227267
Alexey Samsonov [Tue, 27 Jan 2015 23:06:48 +0000 (23:06 +0000)]
[ASan] Fix test cases: don't assume that fast unwinder can't unwind through libc.
llvm-svn: 227265
Eric Fiselier [Tue, 27 Jan 2015 23:05:41 +0000 (23:05 +0000)]
Fix definition of __has_feature in r227263
llvm-svn: 227264
Eric Fiselier [Tue, 27 Jan 2015 23:03:38 +0000 (23:03 +0000)]
Ensure __has_feature is defined in test/support/count_new.hpp
llvm-svn: 227263
Zachary Turner [Tue, 27 Jan 2015 23:02:23 +0000 (23:02 +0000)]
Run dos2unix against llvm-pdbdump.
llvm-svn: 227262
Saleem Abdulrasool [Tue, 27 Jan 2015 22:57:39 +0000 (22:57 +0000)]
SymbolRewriter: allow rewriting with comdats
COMDATs must be identically named to the symbol. When support for COMDATs was
introduced, the symbol rewriter was not updated, resulting in rewriting failing
for symbols which were placed into COMDATs. This corrects the behaviour and
adds test cases for this.
llvm-svn: 227261
Saleem Abdulrasool [Tue, 27 Jan 2015 22:57:35 +0000 (22:57 +0000)]
SymbolRewriter: prevent unnecessary rewrite
The rewrite for the pattern based rewrite is unnecessary if the existing name
matches the pattern.
llvm-svn: 227260
Rui Ueyama [Tue, 27 Jan 2015 22:55:29 +0000 (22:55 +0000)]
Remove kindInGroup reference.
That kind of reference was used only in ELFFile, and the use of
that reference there didn't seem to make sense. All test still
pass (after adjusting symbol names) without that code. LLD is
still be able to link LLD and Clang. Looks like we just don't
need this.
http://reviews.llvm.org/D7189
llvm-svn: 227259
Alexey Samsonov [Tue, 27 Jan 2015 22:50:19 +0000 (22:50 +0000)]
[ASan] Fix use-after-scope in COMMON_INTERCEPTOR_ENTER implementation.
Make sure "void *ctx" doesn't point to an object which already went out
of scope. This might also fix -Wuninitialized warnings GCC 4.7 produces
while building ASan runtime.
llvm-svn: 227258
Zachary Turner [Tue, 27 Jan 2015 22:40:14 +0000 (22:40 +0000)]
Add support for dumping debug tables to llvm-pdbdump.
PDB stores some of its data in streams and some in tables.
This patch teaches llvm-pdbdump to dump basic summary data
for the debug tables.
In support of this, this patch also adds some DIA helper
classes, such as a wrapper around an IDiaSymbol interface,
as well as helpers for outputting various enumerations to
a raw_ostream.
llvm-svn: 227257
Sanjay Patel [Tue, 27 Jan 2015 22:26:56 +0000 (22:26 +0000)]
remove function names from comments; NFC
llvm-svn: 227256
Chris Bieneman [Tue, 27 Jan 2015 22:21:06 +0000 (22:21 +0000)]
Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test.
This contains the changes from r227148 & r227154, and also fixes to the test case to properly clean up the stack options.
llvm-svn: 227255
Kostya Serebryany [Tue, 27 Jan 2015 22:19:55 +0000 (22:19 +0000)]
[fuzzer] properly enable asan's coverage feedback
llvm-svn: 227254
Sanjay Patel [Tue, 27 Jan 2015 22:16:52 +0000 (22:16 +0000)]
fix typos; NFC
llvm-svn: 227253
Kostya Serebryany [Tue, 27 Jan 2015 22:08:41 +0000 (22:08 +0000)]
Add a Fuzzer library
Summary:
A simple genetic in-process coverage-guided fuzz testing library.
I've used this fuzzer to test clang-format
(it found 12+ bugs, thanks djasper@ for the fixes!)
and it may also help us test other parts of LLVM.
So why not keep it in the LLVM repository?
I plan to add the cmake build rules later (in a separate patch, if that's ok)
and also add a clang-format-fuzzer target.
See README.txt for details.
Test Plan: Tests will follow separately.
Reviewers: djasper, chandlerc, rnk
Reviewed By: rnk
Subscribers: majnemer, ygribov, dblaikie, llvm-commits
Differential Revision: http://reviews.llvm.org/D7184
llvm-svn: 227252
Kaelyn Takata [Tue, 27 Jan 2015 22:01:39 +0000 (22:01 +0000)]
Fix a think-o in handling ambiguous corrections for a TypoExpr.
Under certain circumstances, the identifier mentioned in the diagnostic
won't match the intended correction even though the replacement
expression and the note pointing to the decl are both correct.
Basically, the TreeTransform assumes the TypoExpr's Consumer points to
the correct TypoCorrection, but the handling of typos that appear to be
ambiguous from the point of view of TransformTypoExpr would cause that
assumption to be violated by altering the Consumer's correction stream.
This fix allows the Consumer's correction stream to be reset to the
right TypoCorrection after successfully resolving the percieved ambiguity.
Included is a fix to suppress correcting the RHS of an assignment to the
LHS of that assignment for non-C++ code, to prevent a regression in
test/SemaObjC/provisional-ivar-lookup.m.
This fixes PR22297.
llvm-svn: 227251
Ahmed Bougacha [Tue, 27 Jan 2015 21:52:16 +0000 (21:52 +0000)]
[SimplifyLibCalls] Don't confuse strcpy_chk for stpcpy_chk.
This was introduced in a faulty refactoring (r225640, mea culpa):
the tests weren't testing the return values, so, for both
__strcpy_chk and __stpcpy_chk, we would return the end of the
buffer (matching stpcpy) instead of the beginning (for strcpy).
The root cause was the prefix "__" being ignored when comparing,
which made us always pick LibFunc::stpcpy_chk.
Pass the LibFunc::Func directly to avoid this kind of error.
Also, make the testcases as explicit as possible to prevent this.
The now-useful testcases expose another, entangled, stpcpy problem,
with the further simplification. This was introduced in a
refactoring (r225640) to match the original behavior.
However, this leads to problems when successive simplifications
generate several similar instructions, none of which are removed
by the custom replaceAllUsesWith.
For instance, InstCombine (the main user) doesn't erase the
instruction in its custom RAUW. When trying to simplify say
__stpcpy_chk:
- first, an stpcpy is created (fortified simplifier),
- second, a memcpy is created (normal simplifier), but the
stpcpy call isn't removed.
- third, InstCombine later revisits the instructions,
and simplifies the first stpcpy to a memcpy. We now have
two memcpys.
llvm-svn: 227250
Sanjoy Das [Tue, 27 Jan 2015 21:38:12 +0000 (21:38 +0000)]
Teach IRCE to look at branch weights when recognizing range checks
Splitting a loop to make range checks redundant is profitable only if
the range check "never" fails. Make this fact a part of recognizing a
range check -- a branch is a range check only if it is expected to
pass (via branch_weights metadata).
Differential Revision: http://reviews.llvm.org/D7192
llvm-svn: 227249
Alexey Samsonov [Tue, 27 Jan 2015 21:34:11 +0000 (21:34 +0000)]
Revert "[x86] Combine x86mmx/i64 to v2i64 conversion to use scalar_to_vector"
This reverts commits r226953 and r226974.
llvm-svn: 227248
Keno Fischer [Tue, 27 Jan 2015 21:33:25 +0000 (21:33 +0000)]
[ExecutionEngine] Fix r227228 tests on Windows
On Windows, we're running MCJIT with ELF, so the module needs to have
its Triple explicitly adjusted.
llvm-svn: 227247
Kevin Enderby [Tue, 27 Jan 2015 21:28:24 +0000 (21:28 +0000)]
dd the option, -link-opt-hints to llvm-objdump used with -macho to print the
Mach-O AArch64 linker optimization hints for ADRP code optimization.
llvm-svn: 227246