summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Use shouldAssumeDSOLocal in isOffsetFoldingLegal.Rafael Espindola2016-06-241-9/+14
| | | | | | This makes it slightly more powerful for dynamic-no-pic. llvm-svn: 273704
* Codegen: Fix broken assumption in Tail Merge.Kyle Butt2016-06-241-1/+1
| | | | | | | | | Tail merge was making the assumption that a layout successor or predecessor was always a cfg successor/predecessor. Remove that assumption. Changes to tests are necessary because the errant cfg edges were preventing optimizations. llvm-svn: 273700
* [codeview] Emit parameter variables in the right orderReid Kleckner2016-06-242-4/+25
| | | | | | | | | | Clang emits them in reverse order to conform to the ABI, which requires left-to-right destruction. As a result, the order doesn't fall out naturally, and we have to sort things out in the backend. Fixes PR28213 llvm-svn: 273696
* [MDT] Always verify machine dominfo if expensive checking is enabled.Chad Rosier2016-06-241-2/+2
| | | | llvm-svn: 273690
* [codeview] Emit base class information from DW_TAG_inheritance nodesReid Kleckner2016-06-242-3/+49
| | | | | | | | | | | | | | | | There are two remaining issues here: 1. No vbptr information 2. Need to mention indirect virtual bases Getting indirect virtual bases is just a matter of adding an "indirect" flag, emitting them in the frontend, and ignoring them when appropriate for DWARF. All virtual bases use the same artificial vbptr field, so I think the vbptr offset will be best represented by an implicit __vbptr$ClassName member similar to our existing __vptr$ member. llvm-svn: 273688
* [MachineDominatorTree] Add a MDT verifier.Chad Rosier2016-06-241-0/+30
| | | | | | Differential Revision: http://reviews.llvm.org/D21657 llvm-svn: 273678
* [codeview] Add classes and unions to the Local/Global UDTs listsHans Wennborg2016-06-232-19/+29
| | | | | | Differential Revision: http://reviews.llvm.org/D21655 llvm-svn: 273626
* MachineScheduler: Followup to debug message changesMatthias Braun2016-06-231-1/+0
| | | | | | | Do not dump intermediate state of the pending queue anymore now that we always dump the final state before picking. llvm-svn: 273618
* Codegen: LICM Remove check for exactly 1 register def.Kyle Butt2016-06-231-1/+0
| | | | | | | | | | | | | | | | | | When considering whether to split an instruction with a memory operand into an explicit load and a register-based instruction, we currently check that the resulting instruction has exactly 1 def. This prevents 2 important LICM optimizations: compares with memory operands, and double indirect calls. All the tests and the test-suite pass without the check. My guess as to original intent is to limit the additional register pressure created by the new instruction, but given that we only split out a single register, it is already limited. The licm-dominance test now checks actual memory loads for hoisting instead of undef, and it tests compares. hoist-invariant-load.ll now checks for 2 hoists, the intended hoist, and a bonus from calling a got-relative function in a loop. llvm-svn: 273616
* MachineScheduler: Improve debug messagesMatthias Braun2016-06-231-7/+7
| | | | | | | Consistenly display available and pending queues immediately before the scheduling choice is done. llvm-svn: 273615
* Preserve DebugInfo when replacing values in DAGCombinerNirav Dave2016-06-234-14/+26
| | | | | | | | | | | | | | | | | | | | | Recommiting after correcting over-eager Debug Value transfer fixing PR28270. [DAG] Previously debug values would transfer debuginfo for the selected start node for a replacement which allows for debug to be dropped. Push debug value transfer to occur with node/value replacement in SelectionDAG, remove now extraneous transfers of debug values. This refixes PR9817 which was being incompletely checked in the testsuite. Reviewers: jyknight Subscribers: dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D21037 llvm-svn: 273585
* [codeview] Emit retained typesHans Wennborg2016-06-232-0/+17
| | | | | | Differential Revision: http://reviews.llvm.org/D21630 llvm-svn: 273579
* [IfConversion] Bugfix: Don't use undef flag while adding use operands.Jonas Paulsson2016-06-231-3/+16
| | | | | | | | | | | | | | | IfConversion used to always add the undef flag when adding a use operand on a newly predicated instruction. This would be an operand for the register being conditionally redefined. Due to the undef flag, the liveness of this register prior to the predicated instruction would get lost. This patch changes this so that such use operands are added only when the register is live, without the undef flag. Reviewed by Quentin Colombet. http://reviews.llvm.org/D209077 llvm-svn: 273545
* Fix doubly included headerMatt Arsenault2016-06-231-1/+0
| | | | llvm-svn: 273528
* Revert r273456, "Preserve DebugInfo when replacing values in DAGCombiner" as ↵Peter Collingbourne2016-06-234-20/+8
| | | | | | it caused pr28270. llvm-svn: 273518
* [ImplicitNullChecks] Hoist trivial depdendencies if possibleSanjoy Das2016-06-221-20/+159
| | | | | | | | | | | | | | | | | | | | | | When trying to convert a loading instruction into a FAULTING_LOAD, we sometimes face code like this: if %R10 is not null: %R9<def> = MOV32ri Immediate %R9<def, tied> = AND32rm %R9, 0x20(%R10) else: goto TRAP In these cases we would like to use the AND32rm instruction as the faulting operation by hoisting the "depedency" def-ing %R9 also above the control flow, transforming the program into: %R9<def> = MOV32ri Immediate %R9<def, tied> = FAULTING_LOAD_OP(AND32rm %R9, 0x20(%R10), FailPath: TRAP) This change teaches ImplicitNullChecks to do the above, when safe. llvm-svn: 273501
* [codeview] Write LF_UDT_SRC_LINE records (PR28251)Hans Wennborg2016-06-221-6/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D21621 llvm-svn: 273495
* IR: Introduce Module::global_objects().Peter Collingbourne2016-06-221-10/+4
| | | | | | | | | | | | This is a convenience iterator that allows clients to enumerate the GlobalObjects within a Module. Also start using it in a few places where it is obviously the right thing to use. Differential Revision: http://reviews.llvm.org/D21580 llvm-svn: 273470
* [MBFI]: Add a new suboption for graph viewerXinliang David Li2016-06-221-3/+19
| | | | | | | | | -view-machine-block-freq-propagation-dags currently support integer and fraction as the suboptions. This patch adds the 'count' suboption to display actual profile count if available. llvm-svn: 273460
* Preserve DebugInfo when replacing values in DAGCombinerNirav Dave2016-06-224-8/+20
| | | | | | | | | | | | | | | | | | | | | Recommiting after fixing over-aggressive assertion [DAG] Previously debug values would transfer debuginfo for the selected start node for a replacement which allows for debug to be dropped. Push debug value transfer to occur with node/value replacement in SelectionDAG, remove now extraneous transfers of debug values. This refixes PR9817 which was being incompletely checked in the testsuite. Reviewers: jyknight Subscribers: dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D21037 llvm-svn: 273456
* AMDGPU: Add convergent flag to INLINEASM instruction.Wei Ding2016-06-223-2/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D21214 llvm-svn: 273455
* [codeview] Add IntroducingVirtual debug info flagReid Kleckner2016-06-221-21/+6
| | | | | | | | CodeView needs to know if a virtual method was introduced in the current class, and base classes may not have complete type information, so we need to thread this bit through from the frontend. llvm-svn: 273453
* [codeview] Defer emission of all referenced complete recordsReid Kleckner2016-06-222-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the motivating example: struct B { int b; }; struct A { B *b; }; int f(A *p) { return p->b->b; } Clang emits complete types for both A and B because they are required to be complete, but our CodeView emission would only emit forward declarations of A and B. This was a consequence of the fact that the A* type must reference the forward declaration of A, which doesn't reference B at all. We can't eagerly emit complete definitions of A and B when we request the forward declaration's type index because of recursive types like linked lists. If we did that, our stack usage could get out of hand, and it would be possible to lower a type while attempting to lower a type, and we would need to double check if our type is already present in the TypeIndexMap after all recursive getTypeIndex calls. Instead, defer complete type emission until after all type lowering has completed. This ensures that all referenced complete types are emitted, and that type lowering is not re-entrant. llvm-svn: 273443
* [codeview] Remove ClassInfoMapReid Kleckner2016-06-222-26/+13
| | | | | | | | | | From a design perspective, complete record type emission should not depend on information from other complete record types. Currently this map is unused, and needlessly accumulates data throughout compilation. llvm-svn: 273431
* [MBFI]: show branch probability in DOT graphXinliang David Li2016-06-221-0/+18
| | | | | | Differential Revision: http://reviews.llvm.org/D21596 llvm-svn: 273430
* [SDAG] Remove FixedArgs parameter from CallLoweringInfo::setCalleeKrzysztof Parzyszek2016-06-226-17/+16
| | | | | | | | | | | The setCallee function will set the number of fixed arguments based on the size of the argument list. The FixedArgs parameter was often explicitly set to 0, leading to a lack of consistent value for non- vararg functions. Differential Revision: http://reviews.llvm.org/D20376 llvm-svn: 273403
* Add an option to enable MBFI dot viewer for a given functionXinliang David Li2016-06-221-1/+6
| | | | llvm-svn: 273366
* [codeview] Improve names of types in scopes and member function idsReid Kleckner2016-06-222-60/+126
| | | | | | | | | | | | We now include namespace scope info in LF_FUNC_ID records and we emit LF_MFUNC_ID records for member functions as we should. Class names are now fully qualified, which is what MSVC does. Add a little bit of scaffolding to handle ThisAdjustment when it arrives in DISubprogram. llvm-svn: 273358
* Clang format change /NFCXinliang David Li2016-06-211-35/+27
| | | | llvm-svn: 273335
* Make DeadMachineInstructionElim preserve CFGMatt Arsenault2016-06-211-0/+5
| | | | llvm-svn: 273330
* Delete some dead code.Rafael Espindola2016-06-211-5/+0
| | | | | | Found by gcc 6. llvm-svn: 273303
* [StackProtector] Fix computation of GSCookieOffset and EHCookieOffset with SEH4Etienne Bergeron2016-06-211-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix the computation of the offsets present in the scopetable when using the SEH (__except_handler4). This patch added an intrinsic to track the position of the allocation on the stack of the EHGuard. This position is needed when producing the ScopeTable. ``` struct _EH4_SCOPETABLE { DWORD GSCookieOffset; DWORD GSCookieXOROffset; DWORD EHCookieOffset; DWORD EHCookieXOROffset; _EH4_SCOPETABLE_RECORD ScopeRecord[1]; }; struct _EH4_SCOPETABLE_RECORD { DWORD EnclosingLevel; long (*FilterFunc)(); union { void (*HandlerAddress)(); void (*FinallyFunc)(); }; }; ``` The code to generate the EHCookie is added in `X86WinEHState.cpp`. Which is adding these instructions when using SEH4. ``` Lfunc_begin0: # BB#0: # %entry pushl %ebp movl %esp, %ebp pushl %ebx pushl %edi pushl %esi subl $28, %esp movl %ebp, %eax <<-- Loading FramePtr movl %esp, -36(%ebp) movl $-2, -16(%ebp) movl $L__ehtable$use_except_handler4_ssp, %ecx xorl ___security_cookie, %ecx movl %ecx, -20(%ebp) xorl ___security_cookie, %eax <<-- XOR FramePtr and Cookie movl %eax, -40(%ebp) <<-- Storing EHGuard leal -28(%ebp), %eax movl $__except_handler4, -24(%ebp) movl %fs:0, %ecx movl %ecx, -28(%ebp) movl %eax, %fs:0 movl $0, -16(%ebp) calll _may_throw_or_crash LBB1_1: # %cont movl -28(%ebp), %eax movl %eax, %fs:0 addl $28, %esp popl %esi popl %edi popl %ebx popl %ebp retl ``` And the corresponding offset is computed: ``` Luse_except_handler4_ssp$parent_frame_offset = -36 .p2align 2 L__ehtable$use_except_handler4_ssp: .long -2 # GSCookieOffset .long 0 # GSCookieXOROffset .long -40 # EHCookieOffset <<---- .long 0 # EHCookieXOROffset .long -2 # ToState .long _catchall_filt # FilterFunction .long LBB1_2 # ExceptionHandler ``` Clang is not yet producing function using SEH4, but it's a work in progress. This patch is a step toward having a valid implementation of SEH4. Unfortunately, it is not yet fully working. The EH registration block is not allocated at the right offset on the stack. Reviewers: rnk, majnemer Subscribers: llvm-commits, chrisha Differential Revision: http://reviews.llvm.org/D21231 llvm-svn: 273281
* [codeview] Fix DenseMap pointer invalidation bugReid Kleckner2016-06-211-6/+9
| | | | | | | | When you have a map holding a unique_ptr, hold a reference to the raw pointer instead of the unique pointer. The unique_ptr will be moved on rehash. llvm-svn: 273268
* Strip trailing whitespaceSimon Pilgrim2016-06-211-4/+4
| | | | llvm-svn: 273264
* [arm+x86] Make GNU variants behave like GNU w.r.t combining sin+cos into sincos.Daniel Sanders2016-06-212-3/+2
| | | | | | | | | | | | | | | | Summary: canCombineSinCosLibcall() would previously combine sin+cos into sincos for GNUX32/GNUEABI/GNUEABIHF regardless of whether UnsafeFPMath were set or not. However, GNU would only combine them for UnsafeFPMath because sincos does not set errno like sin and cos do. It seems likely that this is an oversight. Reviewers: t.p.northover Subscribers: t.p.northover, aemerson, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D21431 llvm-svn: 273259
* [TargetSchedule] Use 'isOutOfOrder' as possible to avoid magic number. NFC.Junmo Park2016-06-211-3/+2
| | | | | | | | | | | Summary: Using isOutOfOrder makes the code more clear. Reviewers: rengolin, atrick, hfinkel. Differential Revision: http://reviews.llvm.org/D21548 llvm-svn: 273255
* Replace silly uses of 'signed' with 'int'David Majnemer2016-06-212-9/+9
| | | | llvm-svn: 273244
* [ImplicitNullCchecks] NFC cleanupSanjoy Das2016-06-211-13/+20
| | | | | | | - Remove unsued constructor - Tighten up the interface for NullCheck llvm-svn: 273231
* Indent consistently.Joerg Sonnenberger2016-06-191-1/+1
| | | | llvm-svn: 273109
* doesSetDirectiveSuppressesReloc -> doesSetDirectiveSuppressReloc, theJoerg Sonnenberger2016-06-181-2/+2
| | | | | | former is grammatically incorrect. llvm-svn: 273100
* [codeview] Emit non-virtual method type.Amjad Aboud2016-06-182-85/+312
| | | | | | Differential Revision: http://reviews.llvm.org/D21011 llvm-svn: 273084
* Codegen: [MBP] Add assert strings. NFCKyle Butt2016-06-171-2/+2
| | | | llvm-svn: 273067
* [codeview] Emit incomplete member pointer types with the unknown modelReid Kleckner2016-06-171-7/+13
| | | | | | | An incomplete member pointer type will always have a size of zero, so we don't need an extra flag. Credit to David Majnemer for the idea. llvm-svn: 273057
* [codeview] Add DIFlags for pointer to member representationsReid Kleckner2016-06-171-7/+35
| | | | | | | | | | | | | | | | Summary: This seems like the least intrusive way to pass this information through. Fixes PR28151 Reviewers: majnemer, aprantl, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21444 llvm-svn: 273053
* Apply another batch of fixes from clang-tidy's ↵Benjamin Kramer2016-06-174-7/+6
| | | | | | | | performance-unnecessary-value-param. Contains some manual fixes. No functionality change intended. llvm-svn: 273047
* [SelectionDAG] Don't treat library calls specially if marked with nobuiltin.Marcin Koscielnicki2016-06-171-2/+3
| | | | | | | | To be used by D19781. Differential Revision: http://reviews.llvm.org/D19801 llvm-svn: 273039
* Avoid duplicated map lookups. No functionality change intended.Benjamin Kramer2016-06-171-2/+1
| | | | llvm-svn: 273030
* Support expanding partial-word cmpxchg to full-word cmpxchg in AtomicExpandPass.James Y Knight2016-06-172-54/+407
| | | | | | | | | | | | | | | | | Many CPUs only have the ability to do a 4-byte cmpxchg (or ll/sc), not 1 or 2-byte. For those, you need to mask and shift the 1 or 2 byte values appropriately to use the 4-byte instruction. This change adds support for cmpxchg-based instruction sets (only SPARC, in LLVM). The support can be extended for LL/SC-based PPC and MIPS in the future, supplanting the ISel expansions those architectures currently use. Tests added for the IR transform and SPARCv9. Differential Revision: http://reviews.llvm.org/D21029 llvm-svn: 273025
* [CodeView] Refactor enumerator emissionDavid Majnemer2016-06-171-9/+17
| | | | | | This addresses Amjad's review comments on D21442. llvm-svn: 273010
* [codeview] Make function names more consistent with MSVCReid Kleckner2016-06-171-29/+38
| | | | | | | | | | | | | | | Names in function id records don't include nested name specifiers or template arguments, but names in the symbol stream include both. For the symbol stream, instead of having Clang put the fully qualified name in the subprogram display name, recreate it from the subprogram scope chain. For the type stream, take the unqualified name and chop of any template arguments. This makes it so that CodeView DI metadata is more similar to DWARF DI metadata. llvm-svn: 273009
OpenPOWER on IntegriCloud