1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 06:22:56 +02:00
llvm-mirror/lib/Analysis
Teresa Johnson bddf373bdc Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm"
This restores the rest of r286297 (part was restored in r286475).
Specifically, it restores the part requiring adding a dependency from
the Analysis to Object library (downstream use changed to correctly
model split BitReader vs BitWriter libraries).

Original description of this part of patch follows:

Module level asm may also contain defs of values. We need to prevent
export of any refs to local values defined in module level asm (e.g. a
ref in normal IR), since that also requires renaming/promotion of the
local. To do that, the summary index builder looks at all values in the
module level asm string that are not marked Weak or Global, which is
exactly the set of locals that are defined. A summary is created for
each of these local defs and flagged as NoRename.

This required adding handling to the BitcodeWriter to look at GV
declarations to see if they have a summary (rather than skipping them
all).

Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to
ensure that an MCAsmParser is available, otherwise the module asm parse
would silently fail. Initialized the asm parser in the opt tool for use
in testing this fix.

Fixes PR30610.

llvm-svn: 286844
2016-11-14 17:12:32 +00:00
..
AliasAnalysis.cpp [BasicAA] Teach BasicAA to handle the inaccessiblememonly and inaccessiblemem_or_argmemonly attributes 2016-11-08 21:07:42 +00:00
AliasAnalysisEvaluator.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
AliasAnalysisSummary.cpp Update a comment. 2016-08-25 01:29:55 +00:00
AliasAnalysisSummary.h Make some LLVM_CONSTEXPR variables const. NFC. 2016-08-25 01:05:08 +00:00
AliasSetTracker.cpp [AliasSetTracker] Make AST smarter about assume intrinsics that don't actually affect memory. 2016-11-07 14:11:45 +00:00
Analysis.cpp [LCSSA] Perform LCSSA verification only for the current loop nest. 2016-10-28 12:57:20 +00:00
AssumptionCache.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
BasicAliasAnalysis.cpp [BasicAA] Teach BasicAA to handle the inaccessiblememonly and inaccessiblemem_or_argmemonly attributes 2016-11-08 21:07:42 +00:00
BlockFrequencyInfo.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
BlockFrequencyInfoImpl.cpp [GraphTraits] Replace all NodeType usage with NodeRef 2016-08-22 21:09:30 +00:00
BranchProbabilityInfo.cpp Enhance calcColdCallHeuristics for InvokeInst 2016-09-23 17:26:14 +00:00
CallGraph.cpp Consistently use ModuleAnalysisManager 2016-08-09 00:28:38 +00:00
CallGraphSCCPass.cpp Use StringRef in Pass/PassManager APIs (NFC) 2016-10-01 02:56:57 +00:00
CallPrinter.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp [PM] Port CFGViewer and CFGPrinter to the new Pass Manager 2016-09-15 18:35:27 +00:00
CFLAndersAliasAnalysis.cpp Make some LLVM_CONSTEXPR variables const. NFC. 2016-08-25 01:05:08 +00:00
CFLGraph.h [CFLAA] Check for pointer types in more places. 2016-07-29 01:23:45 +00:00
CFLSteensAliasAnalysis.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
CGSCCPassManager.cpp Fixup r279618, instantiate *AnalysisManagerProxy<*AnalysisManager,LazyCallGraph::SCC>, instead of *AnalysisManagerProxy<*AnalysisManager,LazyCallGraph::SCC,LazyCallGraph&>, for PassID. 2016-08-30 15:47:13 +00:00
CMakeLists.txt [BPI] Add new LazyBPI analysis 2016-07-28 23:31:12 +00:00
CodeMetrics.cpp [Assumptions] Make collecting ephemeral values not quadratic in the 2016-08-18 17:51:24 +00:00
ConstantFolding.cpp IR: Introduce inrange attribute on getelementptr indices. 2016-11-10 22:34:55 +00:00
CostModel.cpp [LV, X86] Be more optimistic about vectorizing shifts. 2016-08-04 22:48:03 +00:00
Delinearization.cpp
DemandedBits.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
DependenceAnalysis.cpp
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
EHPersonalities.cpp Use the range variant of find instead of unpacking begin/end 2016-08-11 22:21:41 +00:00
GlobalsModRef.cpp Fix regression from my recent GlobalsAA fix. 2016-10-24 21:47:44 +00:00
IndirectCallPromotionAnalysis.cpp Remove another unused variable from r275216 2016-07-12 23:49:17 +00:00
InlineCost.cpp [InlineCost] Remove skew when calculating call costs 2016-11-14 11:14:41 +00:00
InstCount.cpp
InstructionSimplify.cpp Simplify x >=u x >> y and x >=u x udiv y 2016-10-26 19:18:43 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp Normalize file docs. NFC. 2016-07-21 20:52:35 +00:00
IVUsers.cpp Consistently use LoopAnalysisManager 2016-08-09 00:28:52 +00:00
LazyBlockFrequencyInfo.cpp [BPI] Add new LazyBPI analysis 2016-07-28 23:31:12 +00:00
LazyBranchProbabilityInfo.cpp [BPI] Add new LazyBPI analysis 2016-07-28 23:31:12 +00:00
LazyCallGraph.cpp [LCG] Add the necessary functionality to the LazyCallGraph to support inlining. 2016-10-12 07:59:56 +00:00
LazyValueInfo.cpp [LVI] Fix a bug with a guard being the very first instruction in a BB not taken into account 2016-10-21 15:02:21 +00:00
Lint.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings. 2016-08-13 00:50:41 +00:00
LLVMBuild.txt Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm" 2016-11-14 17:12:32 +00:00
Loads.cpp [Loads] Fix crash in is isDereferenceableAndAlignedPointer() 2016-10-28 15:32:28 +00:00
LoopAccessAnalysis.cpp [LAA, LV] Port to new streaming interface for opt remarks. Update LV 2016-09-30 00:01:30 +00:00
LoopInfo.cpp Adds the loop end location to the loop metadata. 2016-11-08 11:18:59 +00:00
LoopPass.cpp [LCSSA] Perform LCSSA verification only for the current loop nest. 2016-10-28 12:57:20 +00:00
LoopPassManager.cpp
LoopUnrollAnalyzer.cpp [LoopUnrollAnalyzer] Handle out of bounds accesses in visitLoad 2016-07-23 02:56:49 +00:00
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp Make some LLVM_CONSTEXPR variables const. NFC. 2016-08-25 01:05:08 +00:00
MemoryDependenceAnalysis.cpp NFC small changes in MemDep 2016-11-08 18:20:51 +00:00
MemoryLocation.cpp
ModuleDebugInfoPrinter.cpp Re-commit "Use StringRef in Support/Darf APIs (NFC)" 2016-10-05 05:59:29 +00:00
ModuleSummaryAnalysis.cpp Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm" 2016-11-14 17:12:32 +00:00
ObjCARCAliasAnalysis.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp Create llvm.addressofreturnaddress intrinsic 2016-10-12 22:13:19 +00:00
OptimizationDiagnosticInfo.cpp [OptDiag] Remove non-printable chars from function name 2016-11-10 17:47:03 +00:00
OrderedBasicBlock.cpp
PHITransAddr.cpp Use the range variant of find instead of unpacking begin/end 2016-08-11 22:21:41 +00:00
PostDominators.cpp
ProfileSummaryInfo.cpp Add isHotBB helper function to ProfileSummaryInfo 2016-11-09 23:36:02 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
RegionPass.cpp [RegionPass] Some minor cleanups 2016-07-19 17:50:27 +00:00
RegionPrinter.cpp
ScalarEvolution.cpp Analysis: Simplify the ScalarEvolution::getGEPExpr() interface. NFCI. 2016-11-13 06:59:50 +00:00
ScalarEvolutionAliasAnalysis.cpp Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
ScalarEvolutionExpander.cpp Revert r286437 r286438, they caused PR30976 2016-11-10 17:55:41 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [ScopedNoAliasAA] collectMDInDomain should be a free function 2016-08-15 03:56:06 +00:00
SparsePropagation.cpp
StratifiedSets.h Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
TargetLibraryInfo.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
TargetTransformInfo.cpp [ARM] Don't convert switches to lookup tables of pointers with ROPI/RWPI 2016-10-07 08:48:24 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp [TBAA] Drop support for "old style" scalar TBAA tags 2016-11-08 20:46:01 +00:00
TypeMetadataUtils.cpp [IR] Make getIndexedOffsetInType return a signed result 2016-07-13 03:42:38 +00:00
ValueTracking.cpp [ValueTracking] recognize even more variants of smin/smax 2016-11-13 20:04:52 +00:00
VectorUtils.cpp Add handling of !invariant.load to PropagateMetadata. 2016-09-11 01:39:08 +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))

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