Dead store

In computer programming, a dead store is a local variable that is assigned a value but is read by no following instruction.Dead stores waste processor time and memory, and may be detected through the use of static program analysis, and removed by an optimizing compiler.[1] Some system libraries have specific functions designed to avoid such dangerous optimizations, e.g. explicit_bzero on OpenBSD.[2] Dead store example in Java: In the above code an ArrayList object was instantiated but never used.Dead store example in JavaScript: The code in the loop repeatedly overwrites the same variable, so it can be reduced to only one call.
computer programminglocal variableinstructionprocessormemorystatic program analysisoptimizing compilerpasswordoptimizationslibrariesOpenBSDgarbage collectorJavaScriptDead codeUnreachable codeCompiler optimizationsPeephole optimizationLocal value numberingLoop nest optimizationLoop splittingLoop unrollingLoop unswitchingSoftware pipeliningStrength reductionData-flowanalysisAvailable expressionCommon subexpression eliminationConstant foldingInduction variable recognition and eliminationLive-variable analysisUpwards exposed usesUse-define chainReaching definitionsGlobal value numberingSparse conditional constant propagationCode generationInstruction schedulingInstruction selectionRegister allocationRematerializationDeforestationTail-call eliminationInterprocedural optimizationBounds-checking eliminationCompile-time function executionDead-code eliminationExpression templatesInline expansionJump threadingPartial evaluationProfile-guided optimizationAlias analysisArray-access analysisControl-flow analysisData-flow analysisDependence analysisEscape analysisPointer analysisShape analysisValue range analysis