llvm-project/llvm/lib/CodeGen
2023-03-22 00:31:48 -07:00
..
AsmPrinter [WebAssembly] Support debug info for TLS + global in PIC mode 2023-03-17 20:16:48 -07:00
GlobalISel [llvm] Use ConstantInt::{isZero,isOne} (NFC) 2023-03-21 17:40:35 -07:00
LiveDebugValues [llvm] Use *{Map,Set}::contains (NFC) 2023-03-15 18:06:32 -07:00
MIRParser Use APInt::getSignificantBits instead of APInt::getMinSignedBits (NFC) 2023-02-19 23:56:52 -08:00
SelectionDAG [llvm] Use llvm::isNullConstant (NFC) 2023-03-22 00:31:48 -07:00
AggressiveAntiDepBreaker.cpp
AggressiveAntiDepBreaker.h
AllocationOrder.cpp
AllocationOrder.h
Analysis.cpp
AssignmentTrackingAnalysis.cpp [Assignment Tracking][NFC] Use BitVectors as masks for SmallVectors 2023-03-21 09:11:54 +00:00
AtomicExpandPass.cpp IR: Add atomicrmw uinc_wrap and udec_wrap 2023-01-24 17:55:11 -04:00
BasicBlockSections.cpp Move global namespace cl::opt inside llvm:: 2023-02-14 00:09:44 -08:00
BasicBlockSectionsProfileReader.cpp [Propeller] Use Fixed MBB ID instead of volatile MachineBasicBlock::Number. 2023-01-17 15:25:29 -08:00
BasicTargetTransformInfo.cpp
BranchFolding.cpp Recommit "Improve and enable folding of conditional branches with tail calls." (2nd Try) 2023-02-06 14:09:17 -06:00
BranchFolding.h
BranchRelaxation.cpp [BranchRelaxation] Strengthen post condition assertions 2023-01-31 08:05:31 -08:00
BreakFalseDeps.cpp
CalcSpillWeights.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
CallBrPrepare.cpp [CodeGen] Fix warnings 2023-02-16 20:08:35 -08:00
CallingConvLower.cpp [CodeGen] Add standard print/debug utilities to MVT 2023-02-07 10:50:14 -08:00
CFGuardLongjmp.cpp
CFIFixup.cpp
CFIInstrInserter.cpp
CMakeLists.txt [llvm] boilerplate for new callbrprepare codegen IR pass 2023-02-16 17:58:33 -08:00
CodeGen.cpp [llvm] boilerplate for new callbrprepare codegen IR pass 2023-02-16 17:58:33 -08:00
CodeGenCommonISel.cpp [NFC] Make FPClassTest a bitmask enumeration 2023-02-24 15:12:16 +07:00
CodeGenPassBuilder.cpp
CodeGenPrepare.cpp [llvm] Use *{Map,Set}::contains (NFC) 2023-03-15 18:06:32 -07:00
CommandFlags.cpp Remove -lower-global-dtors-via-cxa-atexit flag 2023-03-14 14:18:11 -07:00
ComplexDeinterleavingPass.cpp [Codegen][ARM][AArch64] Support symmetric operations on complex numbers 2023-03-14 12:11:10 +00:00
CriticalAntiDepBreaker.cpp
CriticalAntiDepBreaker.h
DeadMachineInstructionElim.cpp
DetectDeadLanes.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
DFAPacketizer.cpp [NFC] Fix incorrect comment in VLIW packetizer 2023-03-01 21:19:06 +08:00
DwarfEHPrepare.cpp Recommit DwarfEHPrepare: insert extra unwind paths for stack protector to instrument 2023-03-16 13:43:17 +00:00
EarlyIfConversion.cpp [MachineTraceMetrics][NFC] Move Strategy enum out of the class 2023-02-14 16:38:47 +03:00
EdgeBundles.cpp
EHContGuardCatchret.cpp
ExecutionDomainFix.cpp Use llvm::count{lr}_{zero,one} (NFC) 2023-01-28 12:41:20 -08:00
ExpandLargeDivRem.cpp
ExpandLargeFpConvert.cpp
ExpandMemCmp.cpp
ExpandPostRAPseudos.cpp
ExpandReductions.cpp
ExpandVectorPredication.cpp
FaultMaps.cpp
FEntryInserter.cpp
FinalizeISel.cpp
FixupStatepointCallerSaved.cpp Use *{Map,Set}::contains (NFC) 2023-03-15 08:46:32 -07:00
FuncletLayout.cpp
GCMetadata.cpp
GCMetadataPrinter.cpp
GCRootLowering.cpp
GlobalMerge.cpp [NFC][TargetParser] Remove llvm/ADT/Triple.h 2023-02-07 12:39:46 +00:00
HardwareLoops.cpp [HardwareLoops] NewPM support. 2023-02-13 09:46:31 +00:00
IfConversion.cpp [llvm][IfConversion] update successor list when merging INLINEASM_BR 2023-02-07 10:28:11 -08:00
ImplicitNullChecks.cpp
IndirectBrExpandPass.cpp
InlineSpiller.cpp [CodeGen] Use *{Set,Map}::contains (NFC) 2023-03-14 08:07:42 -07:00
InterferenceCache.cpp
InterferenceCache.h
InterleavedAccessPass.cpp [RISCV][NFC] Share interleave mask checking logic 2023-03-14 11:02:52 +00:00
InterleavedLoadCombinePass.cpp Use APInt::count{l,r}_{zero,one} (NFC) 2023-02-19 22:04:47 -08:00
IntrinsicLowering.cpp
JMCInstrumenter.cpp
LatencyPriorityQueue.cpp
LazyMachineBlockFrequencyInfo.cpp
LexicalScopes.cpp
LiveDebugVariables.cpp
LiveDebugVariables.h
LiveInterval.cpp
LiveIntervalCalc.cpp
LiveIntervals.cpp
LiveIntervalUnion.cpp
LivePhysRegs.cpp
LiveRangeCalc.cpp
LiveRangeEdit.cpp LiveRangeEdit: Use Register 2023-03-17 17:34:52 -04:00
LiveRangeShrink.cpp
LiveRangeUtils.h
LiveRegMatrix.cpp
LiveRegUnits.cpp
LiveStacks.cpp
LiveVariables.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
LLVMTargetMachine.cpp
LocalStackSlotAllocation.cpp
LoopTraversal.cpp
LowerEmuTLS.cpp
LowLevelType.cpp [AArch64][SME2] Add CodeGen support for target("aarch64.svcount"). 2023-03-02 12:07:41 +00:00
MachineBasicBlock.cpp [MachineBasicBlock] Explicit FT branching param 2023-01-17 17:12:08 -07:00
MachineBlockFrequencyInfo.cpp
MachineBlockPlacement.cpp [CodeGen] Use *{Set,Map}::contains (NFC) 2023-03-14 08:07:42 -07:00
MachineBranchProbabilityInfo.cpp
MachineCFGPrinter.cpp
MachineCheckDebugify.cpp
MachineCombiner.cpp [MachineCombiner] Support local strategy for traces 2023-02-17 13:17:22 +03:00
MachineCopyPropagation.cpp [MachineCopyPropagation] Eliminate spillage copies that might be caused by eviction chain 2023-02-08 03:34:25 +00:00
MachineCSE.cpp
MachineCycleAnalysis.cpp
MachineDebugify.cpp
MachineDominanceFrontier.cpp
MachineDominators.cpp
MachineFrameInfo.cpp
MachineFunction.cpp [llvm] Use *{Map,Set}::contains (NFC) 2023-03-15 18:06:32 -07:00
MachineFunctionPass.cpp
MachineFunctionPrinterPass.cpp
MachineFunctionSplitter.cpp [Pseudo Probe] Do not instrument EH blocks. 2023-01-30 13:26:56 -08:00
MachineInstr.cpp [MC] Define and use MCInstrDesc implicit_uses and implicit_defs. NFC. 2023-01-23 14:44:58 +00:00
MachineInstrBundle.cpp
MachineLateInstrsCleanup.cpp
MachineLICM.cpp [CodeGen] Use *{Set,Map}::contains (NFC) 2023-03-14 08:07:42 -07:00
MachineLoopInfo.cpp
MachineLoopUtils.cpp
MachineModuleInfo.cpp [MC][nfc] Don't use a value after it has been std::move()'d 2023-02-23 15:15:24 -05:00
MachineModuleInfoImpls.cpp
MachineModuleSlotTracker.cpp
MachineOperand.cpp [IR] Add operator<< overload for CmpInst::Predicate (NFC) 2023-03-07 15:10:56 +01:00
MachineOptimizationRemarkEmitter.cpp
MachineOutliner.cpp [NFC][Outliner] Delete default ctors for Candidate & OutlinedFunction. 2023-03-20 11:17:10 -07:00
MachinePassManager.cpp [PassManager] Run PassInstrumentation after analysis invalidation 2023-03-15 08:36:14 -07:00
MachinePipeliner.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
MachinePostDominators.cpp
MachineRegionInfo.cpp
MachineRegisterInfo.cpp
MachineScheduler.cpp [MISched] Dump the execution trace of the schedule. 2023-01-26 17:54:55 +01:00
MachineSink.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
MachineSizeOpts.cpp
MachineSSAContext.cpp [llvm][Uniformity] A phi with an undef argument is not always divergent 2023-02-20 14:26:43 +05:30
MachineSSAUpdater.cpp
MachineStableHash.cpp
MachineStripDebug.cpp
MachineTraceMetrics.cpp [MachineTraceMetrics] Add local strategy 2023-02-15 15:53:14 +03:00
MachineUniformityAnalysis.cpp [AMDGPU] Use UniformityAnalysis in AtomicOptimizer 2023-03-15 09:39:55 +01:00
MachineVerifier.cpp [llvm] add CallBrPrepare pass to pipelines 2023-02-16 17:58:34 -08:00
MacroFusion.cpp
MBFIWrapper.cpp
MIRCanonicalizerPass.cpp
MIRFSDiscriminator.cpp [FSAFDO] Improve FS discriminator encoding 2023-03-09 23:18:48 -08:00
MIRNamerPass.cpp
MIRPrinter.cpp [DebugInfo] Store instr-ref mode of MachineFunction in member 2023-01-20 14:47:11 +00:00
MIRPrintingPass.cpp
MIRSampleProfile.cpp [FSAFDO] Improve FS discriminator encoding 2023-03-09 23:18:48 -08:00
MIRVRegNamerUtils.cpp [CodeGen] Use *{Set,Map}::contains (NFC) 2023-03-14 08:07:42 -07:00
MIRVRegNamerUtils.h
MIRYamlMapping.cpp
MLRegallocEvictAdvisor.cpp Move global namespace cl::opt inside llvm:: 2023-02-14 00:09:44 -08:00
MLRegallocEvictAdvisor.h
MLRegallocPriorityAdvisor.cpp [mlgo][regalloc] Handle training case when no regalloc happens. 2023-02-06 13:57:16 -08:00
ModuloSchedule.cpp
MultiHazardRecognizer.cpp
NonRelocatableStringpool.cpp
OptimizePHIs.cpp
ParallelCG.cpp
PatchableFunction.cpp
PeepholeOptimizer.cpp
PHIElimination.cpp
PHIEliminationUtils.cpp
PHIEliminationUtils.h
PostRAHazardRecognizer.cpp
PostRASchedulerList.cpp
PreISelIntrinsicLowering.cpp
ProcessImplicitDefs.cpp
PrologEpilogInserter.cpp Revert "HHVM calling conventions." 2023-02-09 10:53:11 -08:00
PseudoProbeInserter.cpp [FSAFDO] Improve FS discriminator encoding 2023-03-09 23:18:48 -08:00
PseudoSourceValue.cpp
RDFGraph.cpp [MC] Define and use MCInstrDesc implicit_uses and implicit_defs. NFC. 2023-01-23 14:44:58 +00:00
RDFLiveness.cpp
RDFRegisters.cpp
ReachingDefAnalysis.cpp
README.txt
RegAllocBase.cpp
RegAllocBase.h
RegAllocBasic.cpp
RegAllocEvictionAdvisor.cpp Move global namespace cl::opt inside llvm:: 2023-02-14 00:09:44 -08:00
RegAllocEvictionAdvisor.h
RegAllocFast.cpp [RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR 2023-03-01 15:21:11 -08:00
RegAllocGreedy.cpp RegAllocGreedy: Don't use Register reference 2023-03-17 15:22:13 -04:00
RegAllocGreedy.h
RegAllocPBQP.cpp
RegAllocPriorityAdvisor.cpp Reland "[mlgo] Hook up the interactive runner to the mlgo-ed passes" 2023-02-03 17:54:42 -08:00
RegAllocPriorityAdvisor.h
RegAllocScore.cpp
RegAllocScore.h
RegisterBank.cpp
RegisterBankInfo.cpp AMDGPU: Partially fix machine uniformity for inline asm 2023-01-30 15:47:18 -04:00
RegisterClassInfo.cpp
RegisterCoalescer.cpp
RegisterCoalescer.h
RegisterPressure.cpp
RegisterScavenging.cpp
RegisterUsageInfo.cpp
RegUsageInfoCollector.cpp
RegUsageInfoPropagate.cpp
RemoveRedundantDebugValues.cpp
RenameIndependentSubregs.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
ReplaceWithVeclib.cpp
ResetMachineFunctionPass.cpp
SafeStack.cpp
SafeStackLayout.cpp
SafeStackLayout.h
SanitizerBinaryMetadata.cpp [SanitizerBinaryMetadata] Emit constants as ULEB128 2023-02-08 13:12:34 +01:00
ScheduleDAG.cpp [ScheduleDAG] Fix removing edges with weak deps 2023-01-25 10:05:50 -08:00
ScheduleDAGInstrs.cpp [CodeGen] Use LLVM_ATTRIBUTE_UNUSED instead of LLVM_DUMP_METHOD on a raw_ostream operator<<. 2023-02-27 18:12:18 -08:00
ScheduleDAGPrinter.cpp
ScoreboardHazardRecognizer.cpp
SelectOptimize.cpp
ShadowStackGCLowering.cpp
ShrinkWrap.cpp
SjLjEHPrepare.cpp
SlotIndexes.cpp [CodeGen] Use *{Set,Map}::contains (NFC) 2023-03-14 08:07:42 -07:00
SpillPlacement.cpp
SpillPlacement.h
SplitKit.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
SplitKit.h
StackColoring.cpp
StackFrameLayoutAnalysisPass.cpp [llvm][codegen] Fix non-determinism in StackFrameLayoutAnalysisPass output 2023-01-19 20:04:14 +00:00
StackMapLivenessAnalysis.cpp
StackMaps.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
StackProtector.cpp StackProtector: expose RequiresStackProtector publicly. NFC. 2023-03-16 11:32:45 +00:00
StackSlotColoring.cpp
SwiftErrorValueTracking.cpp
SwitchLoweringUtils.cpp
TailDuplication.cpp
TailDuplicator.cpp [TailDuplicator] Fix old bugs in TailDuplicator::duplicateInstruction 2023-02-06 19:21:23 +01:00
TargetFrameLoweringImpl.cpp Revert "HHVM calling conventions." 2023-02-09 10:53:11 -08:00
TargetInstrInfo.cpp [MachineCombiner] Preserve debug instruction number 2023-03-13 09:29:30 -04:00
TargetLoweringBase.cpp [CodeGen] Always expand division larger than i128 2023-03-01 15:33:45 +01:00
TargetLoweringObjectFileImpl.cpp Remove -lower-global-dtors-via-cxa-atexit flag 2023-03-14 14:18:11 -07:00
TargetOptionsImpl.cpp
TargetPassConfig.cpp Remove -lower-global-dtors-via-cxa-atexit flag 2023-03-14 14:18:11 -07:00
TargetRegisterInfo.cpp Use llvm::count{lr}_{zero,one} (NFC) 2023-01-28 12:41:20 -08:00
TargetSchedule.cpp [MC] Make more use of MCInstrDesc::operands. NFC. 2023-01-23 11:31:41 +00:00
TargetSubtargetInfo.cpp
TwoAddressInstructionPass.cpp [CodeGen] Define and use MachineOperand::getOperandNo 2023-02-07 11:50:57 +00:00
TypePromotion.cpp [TypePromotion] Deference pointer before printing it in a debug message. 2023-03-02 23:43:36 -08:00
UnreachableBlockElim.cpp
ValueTypes.cpp [SPIR-V] Add Machine Value Type for SPIR-V builtins 2023-03-20 23:15:34 +01:00
VirtRegMap.cpp
VLIWMachineScheduler.cpp
WasmEHPrepare.cpp
WinEHPrepare.cpp [NFC][TargetParser] Remove llvm/ADT/Triple.h 2023-02-07 12:39:46 +00:00
XRayInstrumentation.cpp [NFC][TargetParser] Remove llvm/ADT/Triple.h 2023-02-07 12:39:46 +00:00

//===---------------------------------------------------------------------===//

Common register allocation / spilling problem:

        mul lr, r4, lr
        str lr, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        ldr r4, [sp, #+52]
        mla r4, r3, lr, r4

can be:

        mul lr, r4, lr
        mov r4, lr
        str lr, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        mla r4, r3, lr, r4

and then "merge" mul and mov:

        mul r4, r4, lr
        str r4, [sp, #+52]
        ldr lr, [r1, #+32]
        sxth r3, r3
        mla r4, r3, lr, r4

It also increase the likelihood the store may become dead.

//===---------------------------------------------------------------------===//

bb27 ...
        ...
        %reg1037 = ADDri %reg1039, 1
        %reg1038 = ADDrs %reg1032, %reg1039, %noreg, 10
    Successors according to CFG: 0x8b03bf0 (#5)

bb76 (0x8b03bf0, LLVM BB @0x8b032d0, ID#5):
    Predecessors according to CFG: 0x8b0c5f0 (#3) 0x8b0a7c0 (#4)
        %reg1039 = PHI %reg1070, mbb<bb76.outer,0x8b0c5f0>, %reg1037, mbb<bb27,0x8b0a7c0>

Note ADDri is not a two-address instruction. However, its result %reg1037 is an
operand of the PHI node in bb76 and its operand %reg1039 is the result of the
PHI node. We should treat it as a two-address code and make sure the ADDri is
scheduled after any node that reads %reg1039.

//===---------------------------------------------------------------------===//

Use local info (i.e. register scavenger) to assign it a free register to allow
reuse:
        ldr r3, [sp, #+4]
        add r3, r3, #3
        ldr r2, [sp, #+8]
        add r2, r2, #2
        ldr r1, [sp, #+4]  <==
        add r1, r1, #1
        ldr r0, [sp, #+4]
        add r0, r0, #2

//===---------------------------------------------------------------------===//

LLVM aggressively lift CSE out of loop. Sometimes this can be negative side-
effects:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
load [i + R1]
...
load [i + R2]
...
load [i + R3]

Suppose there is high register pressure, R1, R2, R3, can be spilled. We need
to implement proper re-materialization to handle this:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
R1 = X + 4  @ re-materialized
load [i + R1]
...
R2 = X + 7 @ re-materialized
load [i + R2]
...
R3 = X + 15 @ re-materialized
load [i + R3]

Furthermore, with re-association, we can enable sharing:

R1 = X + 4
R2 = X + 7
R3 = X + 15

loop:
T = i + X
load [T + 4]
...
load [T + 7]
...
load [T + 15]
//===---------------------------------------------------------------------===//

It's not always a good idea to choose rematerialization over spilling. If all
the load / store instructions would be folded then spilling is cheaper because
it won't require new live intervals / registers. See 2003-05-31-LongShifts for
an example.

//===---------------------------------------------------------------------===//

With a copying garbage collector, derived pointers must not be retained across
collector safe points; the collector could move the objects and invalidate the
derived pointer. This is bad enough in the first place, but safe points can
crop up unpredictably. Consider:

        %array = load { i32, [0 x %obj] }** %array_addr
        %nth_el = getelementptr { i32, [0 x %obj] }* %array, i32 0, i32 %n
        %old = load %obj** %nth_el
        %z = div i64 %x, %y
        store %obj* %new, %obj** %nth_el

If the i64 division is lowered to a libcall, then a safe point will (must)
appear for the call site. If a collection occurs, %array and %nth_el no longer
point into the correct object.

The fix for this is to copy address calculations so that dependent pointers
are never live across safe point boundaries. But the loads cannot be copied
like this if there was an intervening store, so may be hard to get right.

Only a concurrent mutator can trigger a collection at the libcall safe point.
So single-threaded programs do not have this requirement, even with a copying
collector. Still, LLVM optimizations would probably undo a front-end's careful
work.

//===---------------------------------------------------------------------===//

The ocaml frametable structure supports liveness information. It would be good
to support it.

//===---------------------------------------------------------------------===//

The FIXME in ComputeCommonTailLength in BranchFolding.cpp needs to be
revisited. The check is there to work around a misuse of directives in inline
assembly.

//===---------------------------------------------------------------------===//

It would be good to detect collector/target compatibility instead of silently
doing the wrong thing.

//===---------------------------------------------------------------------===//

It would be really nice to be able to write patterns in .td files for copies,
which would eliminate a bunch of explicit predicates on them (e.g. no side
effects).  Once this is in place, it would be even better to have tblgen
synthesize the various copy insertion/inspection methods in TargetInstrInfo.

//===---------------------------------------------------------------------===//

Stack coloring improvements:

1. Do proper LiveStacks analysis on all stack objects including those which are
   not spill slots.
2. Reorder objects to fill in gaps between objects.
   e.g. 4, 1, <gap>, 4, 1, 1, 1, <gap>, 4 => 4, 1, 1, 1, 1, 4, 4

//===---------------------------------------------------------------------===//

The scheduler should be able to sort nearby instructions by their address. For
example, in an expanded memset sequence it's not uncommon to see code like this:

  movl $0, 4(%rdi)
  movl $0, 8(%rdi)
  movl $0, 12(%rdi)
  movl $0, 0(%rdi)

Each of the stores is independent, and the scheduler is currently making an
arbitrary decision about the order.

//===---------------------------------------------------------------------===//

Another opportunitiy in this code is that the $0 could be moved to a register:

  movl $0, 4(%rdi)
  movl $0, 8(%rdi)
  movl $0, 12(%rdi)
  movl $0, 0(%rdi)

This would save substantial code size, especially for longer sequences like
this. It would be easy to have a rule telling isel to avoid matching MOV32mi
if the immediate has more than some fixed number of uses. It's more involved
to teach the register allocator how to do late folding to recover from
excessive register pressure.