1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib/Analysis
David Majnemer b6d3704975 [LoopUnrollAnalyzer] Handle out of bounds accesses in visitLoad
While we handed loads past the end of an array, we didn't handle loads
_before_ the array.

This fixes PR28062.

N.B. While the bug in the code is obvious, I am struggling to craft a
test case which is reasonable in size.

llvm-svn: 276510
2016-07-23 02:56:49 +00:00
..
AliasAnalysis.cpp [AliasAnalysis] Give back AA results for fence instructions 2016-07-15 17:19:24 +00:00
AliasAnalysisEvaluator.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
AliasAnalysisSummary.cpp [CFLAA] Add more offset-sensitivity tracking. 2016-07-22 22:30:48 +00:00
AliasAnalysisSummary.h [CFLAA] Add more offset-sensitivity tracking. 2016-07-22 22:30:48 +00:00
AliasSetTracker.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
Analysis.cpp [OptRemarkEmitter] Port to new PM 2016-07-18 16:29:21 +00:00
AssumptionCache.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
BasicAliasAnalysis.cpp BasicAA should look through functions with returned arguments 2016-07-11 01:32:20 +00:00
BlockFrequencyInfo.cpp [BFI] Add new LazyBFI analysis pass 2016-07-13 05:01:48 +00:00
BlockFrequencyInfoImpl.cpp [BFI]: NFC refactoring 2016-06-22 17:12:12 +00:00
BranchProbabilityInfo.cpp Re-submit r272891 "Prevent dangling pointer problems in BranchProbabilityInfo" 2016-07-15 14:31:16 +00:00
CallGraph.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
CallGraphSCCPass.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
CallPrinter.cpp [CG] Rename the DOT printing pass to actually reference "DOT". 2016-03-10 11:04:40 +00:00
CaptureTracking.cpp [CaptureTracking] Volatile operations capture their memory location 2016-05-26 17:36:22 +00:00
CFG.cpp Avoid overly large SmallPtrSet/SmallSet 2016-01-30 01:24:31 +00:00
CFGPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
CFLAndersAliasAnalysis.cpp [CFLAA] Add more offset-sensitivity tracking. 2016-07-22 22:30:48 +00:00
CFLGraph.h [CFLAA] Add more offset-sensitivity tracking. 2016-07-22 22:30:48 +00:00
CFLSteensAliasAnalysis.cpp [CFLAA] Add more offset-sensitivity tracking. 2016-07-22 22:30:48 +00:00
CGSCCPassManager.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
CMakeLists.txt [OptRemark,LDist] RFC: Add hotness attribute 2016-07-15 17:23:20 +00:00
CodeMetrics.cpp use range-based for loop; NFCI 2016-03-08 20:53:48 +00:00
ConstantFolding.cpp [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR 2016-07-19 15:07:43 +00:00
CostModel.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
Delinearization.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
DemandedBits.cpp [DemandedBits] Reduce number of duplicated DenseMap lookups. 2016-07-21 13:37:55 +00:00
DependenceAnalysis.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
DivergenceAnalysis.cpp DivergenceAnalysis: Fix crash with no return blocks 2016-05-09 16:57:08 +00:00
DominanceFrontier.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
DomPrinter.cpp Introduce analysis pass to compute PostDominators in the new pass manager. NFC 2016-02-25 17:54:07 +00:00
EHPersonalities.cpp X86: permit using SjLj EH on x86 targets as an option 2016-05-31 01:48:07 +00:00
GlobalsModRef.cpp GlobalsAA: Functions with the argmemonly attribute won't read arbitrary globals 2016-07-14 15:50:27 +00:00
IndirectCallPromotionAnalysis.cpp Remove another unused variable from r275216 2016-07-12 23:49:17 +00:00
InlineCost.cpp Implement callsite-hotness based inline cost for Sample-based PGO 2016-07-11 16:48:54 +00:00
InstCount.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
InstructionSimplify.cpp [InstSimplify] don't crash handling a pointer or aggregate type 2016-07-21 21:56:00 +00:00
Interval.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
IntervalPartition.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
IteratedDominanceFrontier.cpp Normalize file docs. NFC. 2016-07-21 20:52:35 +00:00
IVUsers.cpp [PM] Convert IVUsers analysis to new pass manager. 2016-07-16 22:51:33 +00:00
LazyBlockFrequencyInfo.cpp [BFI] Add new LazyBFI analysis pass 2016-07-13 05:01:48 +00:00
LazyCallGraph.cpp [LCG] Hoist the definitions of the stream operator friends to be inline 2016-07-07 07:52:07 +00:00
LazyValueInfo.cpp Reformat blank lines. 2016-07-04 01:26:33 +00:00
Lint.cpp [opaque pointer types] [NFC] FindAvailableLoadedValue: take LoadInst instead of just the pointer. 2016-01-22 01:51:51 +00:00
LLVMBuild.txt Refactor indirect call promotion profitability analysis (NFC) 2016-07-12 21:13:44 +00:00
Loads.cpp Teach isDereferenceablePointer to look through returned-argument functions 2016-07-11 03:08:49 +00:00
LoopAccessAnalysis.cpp [OptDiag,LV] Add hotness attribute to analysis remarks 2016-07-20 21:44:26 +00:00
LoopInfo.cpp [PM] Port LoopUnroll. 2016-07-19 23:54:23 +00:00
LoopPass.cpp [LoopPass] Some minor cleanups 2016-07-19 17:50:24 +00:00
LoopPassManager.cpp PM: Check that loop passes preserve a basic set of analyses 2016-05-03 21:35:08 +00:00
LoopUnrollAnalyzer.cpp [LoopUnrollAnalyzer] Handle out of bounds accesses in visitLoad 2016-07-23 02:56:49 +00:00
MemDepPrinter.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
MemDerefPrinter.cpp NFC. Move isDereferenceable to Loads.h/cpp 2016-02-24 12:49:04 +00:00
MemoryBuiltins.cpp fix formatting; NFC 2016-07-07 16:19:09 +00:00
MemoryDependenceAnalysis.cpp Typos. NFC. 2016-06-28 17:19:10 +00:00
MemoryLocation.cpp [TLI] Unify LibFunc signature checking. NFCI. 2016-04-27 19:04:35 +00:00
ModuleDebugInfoPrinter.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
ModuleSummaryAnalysis.cpp [ThinLTO] Perform profile-guided indirect call promotion 2016-07-17 14:47:01 +00:00
ObjCARCAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
ObjCARCAnalysisUtils.cpp [ARC] Pull the ObjC ARC components that really serve the role of 2015-08-20 08:06:03 +00:00
ObjCARCInstKind.cpp Add support for objc_unsafeClaimAutoreleasedReturnValue to the 2016-01-27 19:05:08 +00:00
OptimizationDiagnosticInfo.cpp [OptDiag] Missed these when making the IR Value a const pointer 2016-07-21 01:11:12 +00:00
OrderedBasicBlock.cpp [CaptureTracker] Provide an ordered basic block to PointerMayBeCapturedBefore 2015-07-31 14:31:35 +00:00
PHITransAddr.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
PostDominators.cpp [PM] Remove support for omitting the AnalysisManager argument to new 2016-06-17 00:11:01 +00:00
ProfileSummaryInfo.cpp [PM] Remove support for omitting the AnalysisManager argument to new 2016-06-17 00:11:01 +00:00
PtrUseVisitor.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
README.txt
RegionInfo.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
RegionPass.cpp [RegionPass] Some minor cleanups 2016-07-19 17:50:27 +00:00
RegionPrinter.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
ScalarEvolution.cpp [SCEV] Make isImpliedCondOperandsViaRanges smarter 2016-07-23 00:54:36 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
ScalarEvolutionExpander.cpp Use ValueOffsetPair to enhance value reuse during SCEV expansion. 2016-07-20 16:40:33 +00:00
ScalarEvolutionNormalization.cpp Remove emacs mode markers from .cpp files. NFC 2016-04-24 17:55:41 +00:00
ScopedNoAliasAA.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
SparsePropagation.cpp Apply clang-tidy's modernize-loop-convert to lib/Analysis. 2016-06-26 17:27:42 +00:00
StratifiedSets.h [CFLAA] Simplify CFLGraphBuilder. NFC. 2016-07-11 22:59:09 +00:00
TargetLibraryInfo.cpp Reverting r275284 due to platform-specific test failures 2016-07-13 19:09:16 +00:00
TargetTransformInfo.cpp This implements a more optimal algorithm for selecting a base constant in 2016-07-14 07:44:20 +00:00
Trace.cpp Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
TypeBasedAliasAnalysis.cpp [PM] Make the AnalysisManager parameter to run methods a reference. 2016-03-11 11:05:24 +00:00
TypeMetadataUtils.cpp [IR] Make getIndexedOffsetInType return a signed result 2016-07-13 03:42:38 +00:00
ValueTracking.cpp [ValueTracking] Use Instruction::getFunction; NFC 2016-07-14 20:19:01 +00:00
VectorUtils.cpp SLPVectorizer: Move propagateMetadata to VectorUtils 2016-06-30 21:17:59 +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))

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