[PATCH][instcombine] Remove preservesCFG from instcombine

Andrew Trick atrick at apple.com
Tue Nov 4 22:45:14 PST 2014


This is what started the thread…

>> // setPreservesCFG - This function should be called to by the pass,
>> iff they do
>> // not:
>> //
>> // 1. Add or remove basic blocks from the function
>> // 2. Modify terminator instructions in any way.
>>
>>
>> Clearly instcombine is modifying terminator instructions so should
>> not be calling setPreservesCFG(). The specific issue I ran into was
>> a dead loop not being deleted because of stale analysis data.

I’m very happy that we can continue using setPreservesCFG according to sane rules, but the comment should be updated to reflect those rules.

-Andy

> On Nov 4, 2014, at 3:13 PM, Mark Heffernan <meheff at google.com> wrote:
> 
> Thanks!  r221311.
> 
> Mark
> 
> On Tue, Nov 4, 2014 at 2:51 PM, Chandler Carruth <chandlerc at google.com <mailto:chandlerc at google.com>> wrote:
> LGTM! This looks like the perfect minimal fix. Thanks for tracking this down, I think this has actually been a root cause of a few things I've tried (and failed) to debug as well.
> 
> On Tue, Nov 4, 2014 at 4:06 PM, Mark Heffernan <meheff at google.com <mailto:meheff at google.com>> wrote:
> On Tue, Nov 4, 2014 at 12:46 PM, Chandler Carruth <chandlerc at google.com <mailto:chandlerc at google.com>> wrote:
> Can you show the same diff to the pass structure for the latter change?
> 
> Here you go (for -O2).  The only difference is an additional loopsimplify pass.  The baseline here is the state before my earlier patch, so this diff only represents changing LoopSimplify to !isCfgOnly.
> 
> --- passes.before.txt 2014-11-04 13:59:22.933766046 -0800
> +++ passes.after.txt 2014-11-04 13:53:04.199887020 -0800
> @@ -1,122 +1,123 @@
>  Pass Arguments:  -datalayout -notti -basictti -x86tti -no-aa -tbaa -scoped-noalias -assumption-tracker -targetlibinfo -basicaa -verify -simplifycfg -domtree -sroa -early-cse -lower-expect
>  Data Layout
>  No target information
>  Target independent code generator's TTI
>  X86 Target Transform Info
>  No Alias Analysis (always returns 'may' alias)
>  Type-Based Alias Analysis
>  Scoped NoAlias Alias Analysis
>  Assumption Tracker
>  Target Library Information
>  Basic Alias Analysis (stateless AA impl)
>    FunctionPass Manager
>      Module Verifier
>      Simplify the CFG
>      Dominator Tree Construction
>      SROA
>      Early CSE
>      Lower 'expect' Intrinsics
> -Pass Arguments:  -targetlibinfo -datalayout -notti -basictti -x86tti -no-aa -tbaa -scoped-noalias -assumption-tracker -basicaa -verify-di -ipsccp -globalopt -deadargelim -instcombine -simplifycfg -basiccg -prune-eh -inline-cost -inline -functionattrs -sroa -domtree -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -tailcallelim -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -instcombine -scalar-evolution -lcssa -indvars -loop-idiom -loop-deletion -function_tti -loop-unroll -memdep -mldst-motion -domtree -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -memdep -dse -adce -simplifycfg -instcombine -barrier -domtree -loops -loop-simplify -lcssa -branch-prob -block-freq -scalar-evolution -loop-vectorize -instcombine -scalar-evolution -slp-vectorizer -simplifycfg -instcombine -domtree -loops -loop-simplify -lcssa -scalar-evolution -function_tti -loop-unroll -alignment-from-assumptions -strip-dead-prototypes -globaldce -constmerge -verify -verify-di
> +Pass Arguments:  -targetlibinfo -datalayout -notti -basictti -x86tti -no-aa -tbaa -scoped-noalias -assumption-tracker -basicaa -verify-di -ipsccp -globalopt -deadargelim -instcombine -simplifycfg -basiccg -prune-eh -inline-cost -inline -functionattrs -sroa -domtree -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -tailcallelim -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -function_tti -loop-unroll -memdep -mldst-motion -domtree -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -memdep -dse -adce -simplifycfg -instcombine -barrier -domtree -loops -loop-simplify -lcssa -branch-prob -block-freq -scalar-evolution -loop-vectorize -instcombine -scalar-evolution -slp-vectorizer -simplifycfg -instcombine -domtree -loops -loop-simplify -lcssa -scalar-evolution -function_tti -loop-unroll -alignment-from-assumptions -strip-dead-prototypes -globaldce -constmerge -verify -verify-di
>  Target Library Information
>  Data Layout
>  No target information
>  Target independent code generator's TTI
>  X86 Target Transform Info
>  No Alias Analysis (always returns 'may' alias)
>  Type-Based Alias Analysis
>  Scoped NoAlias Alias Analysis
>  Assumption Tracker
>  Basic Alias Analysis (stateless AA impl)
>    ModulePass Manager
>      Debug Info Verifier
>      Interprocedural Sparse Conditional Constant Propagation
>      Global Variable Optimizer
>      Dead Argument Elimination
>      FunctionPass Manager
>        Combine redundant instructions
>        Simplify the CFG
>      CallGraph Construction
>      Call Graph SCC Pass Manager
>        Remove unused exception handling info
>        Inline Cost Analysis
>        Function Integration/Inlining
>        Deduce function attributes
>        FunctionPass Manager
>          SROA
>          Dominator Tree Construction
>          Early CSE
>          Lazy Value Information Analysis
>          Jump Threading
>          Value Propagation
>          Simplify the CFG
>          Combine redundant instructions
>          Tail Call Elimination
>          Simplify the CFG
>          Reassociate expressions
>          Dominator Tree Construction
>          Natural Loop Information
>          Canonicalize natural loops
>          Loop-Closed SSA Form Pass
>          Loop Pass Manager
>            Rotate Loops
>            Loop Invariant Code Motion
>            Unswitch loops
>          Combine redundant instructions
>          Scalar Evolution Analysis
> +        Canonicalize natural loops
>          Loop-Closed SSA Form Pass
>          Loop Pass Manager
>            Induction Variable Simplification
>            Recognize loop idioms
>            Delete dead loops
>          Function TargetTransformInfo
>          Loop Pass Manager
>            Unroll loops
>          Memory Dependence Analysis
>          MergedLoadStoreMotion
>          Dominator Tree Construction
>          Memory Dependence Analysis
>          Global Value Numbering
>          Memory Dependence Analysis
>          MemCpy Optimization
>          Sparse Conditional Constant Propagation
>          Combine redundant instructions
>          Lazy Value Information Analysis
>          Jump Threading
>          Value Propagation
>          Dominator Tree Construction
>          Memory Dependence Analysis
>          Dead Store Elimination
>          Aggressive Dead Code Elimination
>          Simplify the CFG
>          Combine redundant instructions
>      A No-Op Barrier Pass
>      FunctionPass Manager
>        Dominator Tree Construction
>        Natural Loop Information
>        Canonicalize natural loops
>        Loop-Closed SSA Form Pass
>        Branch Probability Analysis
>        Block Frequency Analysis
>        Scalar Evolution Analysis
>        Loop Vectorization
>        Combine redundant instructions
>        Scalar Evolution Analysis
>        SLP Vectorizer
>        Simplify the CFG
>        Combine redundant instructions
>        Dominator Tree Construction
>        Natural Loop Information
>        Canonicalize natural loops
>        Loop-Closed SSA Form Pass
>        Scalar Evolution Analysis
>        Function TargetTransformInfo
>        Loop Pass Manager
>          Unroll loops
>        Alignment from assumptions
>      Strip Unused Function Prototypes
>      Dead Global Elimination
>      Merge Duplicate Global Constants
>      FunctionPass Manager
>        Module Verifier
>      Debug Info Verifier
>      Bitcode Writer
> 
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141104/3a06c47d/attachment.html>


More information about the llvm-commits mailing list