1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib/Analysis
Shiva Chen a2029fa58e [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is

!DILabel(scope: !1, name: "foo", file: !2, line: 3)

We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is

llvm.dbg.label(metadata !1)

It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.

We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.

Differential Revision: https://reviews.llvm.org/D45024

Patch by Hsiangkai Wang.

llvm-svn: 331841
2018-05-09 02:40:45 +00:00
..
AliasAnalysis.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
AliasAnalysisEvaluator.cpp [ModRefInfo] Add must alias info to ModRefInfo. 2017-12-21 21:41:53 +00:00
AliasAnalysisSummary.cpp Update a comment. 2016-08-25 01:29:55 +00:00
AliasAnalysisSummary.h Fix more spelling mistakes in comments of LLVM Analysis passes 2018-03-02 18:57:02 +00:00
AliasSetTracker.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
Analysis.cpp Add an analysis printer for must execute reasoning 2018-03-20 17:09:21 +00:00
AssumptionCache.cpp [Analysis, Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-01 21:37:29 +00:00
BasicAliasAnalysis.cpp Rename invariant.group.barrier to launder.invariant.group 2018-05-03 11:03:01 +00:00
BlockFrequencyInfo.cpp Revert r320104: infinite loop profiling bug fix 2017-12-08 19:38:07 +00:00
BlockFrequencyInfoImpl.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BranchProbabilityInfo.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CallGraph.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
CallGraphSCCPass.cpp [NFC] OptPassGate extracted from OptBisect 2018-03-27 16:57:20 +00:00
CallPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CaptureTracking.cpp [CaptureTracking] Handle capturing of launder.invariant.group 2018-05-05 10:23:27 +00:00
CFG.cpp
CFGPrinter.cpp [CFGVPrinter] Fix -dot-cfg-only 2017-12-19 15:20:18 +00:00
CFLAndersAliasAnalysis.cpp [Analysis] Change std::sort to llvm::sort in response to r327219 2018-04-01 01:46:51 +00:00
CFLGraph.h [CFLGraph][NFC] Simplify/reorder switch in visitConstantExpr 2018-05-01 21:35:32 +00:00
CFLSteensAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CGSCCPassManager.cpp Fixed spelling mistake in comments of LLVM Analysis passes 2018-02-28 19:08:52 +00:00
CMakeLists.txt Add an analysis printer for must execute reasoning 2018-03-20 17:09:21 +00:00
CmpInstAnalysis.cpp [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions 2017-09-01 21:27:34 +00:00
CodeMetrics.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
ConstantFolding.cpp [Evaluator] Evaluate load/store with bitcast 2018-03-13 10:19:50 +00:00
CostModel.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
Delinearization.cpp [NFC] Consolidate six getPointerOperand() utility functions into one place 2018-03-09 21:05:58 +00:00
DemandedBits.cpp Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
DependenceAnalysis.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
DivergenceAnalysis.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
DominanceFrontier.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
DomPrinter.cpp [DomPrinter] Add a way to programmatically dump a dot representation. 2017-04-24 17:48:44 +00:00
EHPersonalities.cpp [EH] Recognize __(gxx|gcc)_personality_seh0 as the GNU EH personalities 2017-05-31 22:35:52 +00:00
GlobalsModRef.cpp [GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA for 2018-03-16 23:51:33 +00:00
IndirectCallPromotionAnalysis.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
InlineCost.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
InstCount.cpp [Analysis] RemoveTotalMemInst counting in InstCount to avoid reading back other Statistic variables 2017-07-18 02:41:12 +00:00
InstructionSimplify.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Interval.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IntervalPartition.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IteratedDominanceFrontier.cpp [Dominators] Make IsPostDominator a template parameter 2017-07-14 18:26:09 +00:00
IVUsers.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
LazyBlockFrequencyInfo.cpp [LazyBFI] Fix typos 2017-02-14 17:21:12 +00:00
LazyBranchProbabilityInfo.cpp [BPI] Don't assume that strcmp returning >0 is more likely than <0 2017-06-08 09:44:40 +00:00
LazyCallGraph.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
LazyValueInfo.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Lint.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LLVMBuild.txt Update libdeps to add BinaryFormat, introduced in r304864. 2017-06-07 04:48:49 +00:00
Loads.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LoopAccessAnalysis.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LoopAnalysisManager.cpp Fixed spelling mistake in comments of LLVM Analysis passes 2018-02-28 19:08:52 +00:00
LoopInfo.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
LoopPass.cpp [NFC] OptPassGate extracted from OptBisect 2018-03-27 16:57:20 +00:00
LoopUnrollAnalyzer.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
MemDepPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemDerefPrinter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
MemoryBuiltins.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
MemoryDependenceAnalysis.cpp [Analysis] Change std::sort to llvm::sort in response to r327219 2018-04-01 01:46:51 +00:00
MemoryLocation.cpp [DSE] Teach the pass that atomic memory intrinsics are stores. 2018-04-23 19:06:49 +00:00
MemorySSA.cpp Rename invariant.group.barrier to launder.invariant.group 2018-05-03 11:03:01 +00:00
MemorySSAUpdater.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ModuleDebugInfoPrinter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
ModuleSummaryAnalysis.cpp [ThinLTO] Add an option to force summary call edges cold for debugging 2018-03-31 00:18:08 +00:00
MustExecute.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ObjCARCAliasAnalysis.cpp [ModRefInfo] Make enum ModRefInfo an enum class [NFC]. 2017-12-07 22:41:34 +00:00
ObjCARCAnalysisUtils.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ObjCARCInstKind.cpp [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
OptimizationRemarkEmitter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
OrderedBasicBlock.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
PHITransAddr.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
PostDominators.cpp [Dominators] Remove verifyDomTree and add some verifying for Post Dom Trees 2018-02-28 11:00:08 +00:00
ProfileSummaryInfo.cpp Fix a typo in a comment; NFC 2018-04-12 18:36:01 +00:00
PtrUseVisitor.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
README.txt
RegionInfo.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
RegionPass.cpp [NFC] OptPassGate extracted from OptBisect 2018-03-27 16:57:20 +00:00
RegionPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScalarEvolution.cpp Re-enable "[SCEV] Make computeExitLimit more simple and more powerful" 2018-05-03 02:37:55 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
ScalarEvolutionExpander.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
ScalarEvolutionNormalization.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScopedNoAliasAA.cpp [ModRefInfo] Make enum ModRefInfo an enum class [NFC]. 2017-12-07 22:41:34 +00:00
StratifiedSets.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
SyntheticCountsUtils.cpp Remove CallGraphTraits and use equivalent methods in GraphTraits 2018-02-01 19:40:35 +00:00
TargetLibraryInfo.cpp Revert "[SimplifyLibcalls] Replace locked IO with unlocked IO" 2018-04-27 01:48:09 +00:00
TargetTransformInfo.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
Trace.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
TypeBasedAliasAnalysis.cpp Fix more spelling mistakes in comments of LLVM Analysis passes 2018-03-02 18:57:02 +00:00
TypeMetadataUtils.cpp Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC. 2017-01-27 22:55:30 +00:00
ValueLattice.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
ValueLatticeUtils.cpp [IPSCCP] Move common functions to ValueLatticeUtils (NFC) 2017-10-13 17:53:44 +00:00
ValueTracking.cpp [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
VectorUtils.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00

Analysis Opportunities:

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

In test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll, the
ScalarEvolution expression for %r is this:

  {1,+,3,+,2}<loop>

Outside the loop, this could be evaluated simply as (%n * %n), however
ScalarEvolution currently evaluates it as

  (-2 + (2 * (trunc i65 (((zext i64 (-2 + %n) to i65) * (zext i64 (-1 + %n) to i65)) /u 2) to i64)) + (3 * %n))

In addition to being much more complicated, it involves i65 arithmetic,
which is very inefficient when expanded into code.

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

In formatValue in test/CodeGen/X86/lsr-delayed-fold.ll,

ScalarEvolution is forming this expression:

((trunc i64 (-1 * %arg5) to i32) + (trunc i64 %arg5 to i32) + (-1 * (trunc i64 undef to i32)))

This could be folded to

(-1 * (trunc i64 undef to i32))

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