Skip to content
Snippets Groups Projects
  • Chandler Carruth's avatar
    c8cfc74b
    Enhance the CFG construction to detect no-return destructors for · c8cfc74b
    Chandler Carruth authored
    temporary objects and local variables. When detected, these split the
    block, marking the new one as having only the exit block as a successor.
    This prevents a large number of false positives in warnings sensitive to
    no-return constructs such as -Wreturn-type, and fixes the remainder of
    PR10063 along with several variations of this bug that had not been
    reported. The test cases are extended across the board to cover these
    patterns.
    
    This also checks in a stress test for these types of CFGs. The stress
    test declares some 32k variables, a mixture of no-return and normal
    destructors. Previously, this resulted in roughly 2500 CFG blocks, but
    didn't model any of the no-return destructors. With this patch, it
    results in over 33k blocks, many of them now unreachable.
    
    The nice thing about how the analyzer is set up? This causes *no*
    regression in performance of building the CFG. It actually in some cases
    makes it faster, as best I can benchmark. The analysis for -Wreturn-type
    (and any other that cares about no-return code paths) is technically
    slower now as it has to look at many more candidate blocks, but it
    computes the correct answer. I have more test cases to follow, I think
    they all work now. Also I have further work that should dramatically
    simplify analyses in the presence of no-return.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
    c8cfc74b
    History
    Enhance the CFG construction to detect no-return destructors for
    Chandler Carruth authored
    temporary objects and local variables. When detected, these split the
    block, marking the new one as having only the exit block as a successor.
    This prevents a large number of false positives in warnings sensitive to
    no-return constructs such as -Wreturn-type, and fixes the remainder of
    PR10063 along with several variations of this bug that had not been
    reported. The test cases are extended across the board to cover these
    patterns.
    
    This also checks in a stress test for these types of CFGs. The stress
    test declares some 32k variables, a mixture of no-return and normal
    destructors. Previously, this resulted in roughly 2500 CFG blocks, but
    didn't model any of the no-return destructors. With this patch, it
    results in over 33k blocks, many of them now unreachable.
    
    The nice thing about how the analyzer is set up? This causes *no*
    regression in performance of building the CFG. It actually in some cases
    makes it faster, as best I can benchmark. The analysis for -Wreturn-type
    (and any other that cares about no-return code paths) is technically
    slower now as it has to look at many more candidate blocks, but it
    computes the correct answer. I have more test cases to follow, I think
    they all work now. Also I have further work that should dramatically
    simplify analyses in the presence of no-return.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.