[llvm-dev] Machine instruction verifier pass

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Thu May 18 10:12:14 PDT 2017


> On May 17, 2017, at 6:53 PM, Jatin Bhateja <jatin.bhateja at gmail.com> wrote:
> 
> Please see my replies embedded.
> 
> Thanks,
> Jatin
> 
> On Thursday, May 18, 2017, Matthias Braun <mbraun at apple.com <mailto:mbraun at apple.com>> wrote:
> - Please do not add any more uses of the LiveVariables pass! It is deprecated and only kept around for one last pass that isn't converted. All new code should use LiveIntervalAnalysis!
> - Kill flags are optional: If they are present they must be correct, but it is legal to have a value die without having a kill flag on the operand. So often a simple fix is to clear out the kill flags from instructions you touch instead of recomputing them. The only downside is that some later passes will only perform the maximum amount of optimization will kill flags present [1]
> 
>  
> PMDataManager keeps tracks of analysis requirements explicitely set by a perticular pass by calling getAnaysisUsage for that pass i.e to either run a specified analysis if its needed or preserve already performed analysis through the execution of the pass if transformation is sure about not dirtying the already computed analysis or simply allow invalidation of analysis.
> 
> Once a pass in the optimization pipeline does not preserve already computed analysis by calling setPreservedAll then any transformation occuring later down the pipeline must recompute the required analysis.
> 
> However, if a pass does not call setPreserveAll then it does not own the responsibility of updating the already computed analysis if it dirty it as a side effect of some other transformation. This is exactly what is happening in this case.  Livevariable analysis was called up the pipeline so that MachineCSE could use the needed analysis. Peephole optimization which is called later in the pipeline does not preserve not requires live variables and dirty the liveness information as a side effect.
> 
> All is correct nothing wrong in the flow as if any other pass in pipeline which need liveness will mention the same in its getAnalysisUsage and since perticular analysis is not preserved by pass ahead of it in the optimization pipeline hence it will get recomputed during schedulePass.
> 
> Now, MachineInstrVerifier pass which is a dumb validation pass always check for consistency of liveness information attached to IR even if transformation which ran just before it does not either require or preserve i.e may invalidate liveness as a side effect.
Sure. However:

- The result of an analysis pass is part of that pass instance. I.e. accessing LiveVariables::getVarInfo() is clearly getting you the result of LiveVariables.
- However as far as I understand you this is about kill flags on machine operands? They are part of the normal MI representation. I don't consider those to be the result of the LiveVariables analysis but a part of MI that should always be correct (I know in practices things are somewhat messy as the big number of addPass(XXX, false) invocations in TargetPassConfig demonstrates...)

- Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170518/b58000a0/attachment-0001.html>


More information about the llvm-dev mailing list