[llvm] 3dd688a - [DAG] OptLevelChanger - fix uninitialized variable analyzer warning (PR44471)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 02:54:51 PST 2020


Author: Simon Pilgrim
Date: 2020-02-04T10:54:33Z
New Revision: 3dd688a9eec238fd4e065e3b373cf6fa47e2184f

URL: https://github.com/llvm/llvm-project/commit/3dd688a9eec238fd4e065e3b373cf6fa47e2184f
DIFF: https://github.com/llvm/llvm-project/commit/3dd688a9eec238fd4e065e3b373cf6fa47e2184f.diff

LOG: [DAG] OptLevelChanger - fix uninitialized variable analyzer warning (PR44471)

Ensure that OptLevelChanger::SavedFastISel is initialized in the constructor.

This should be NFC - as the equivalent 'same opt level' early-out is used in the destructor as well, so SavedFastISel is only actually referenced in the general case.

Differential Revision: https://reviews.llvm.org/D73875

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 6c57c72d47a7..b83c90264274 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -215,6 +215,7 @@ namespace llvm {
     OptLevelChanger(SelectionDAGISel &ISel,
                     CodeGenOpt::Level NewOptLevel) : IS(ISel) {
       SavedOptLevel = IS.OptLevel;
+      SavedFastISel = IS.TM.Options.EnableFastISel;
       if (NewOptLevel == SavedOptLevel)
         return;
       IS.OptLevel = NewOptLevel;
@@ -223,7 +224,6 @@ namespace llvm {
                         << IS.MF->getFunction().getName() << "\n");
       LLVM_DEBUG(dbgs() << "\tBefore: -O" << SavedOptLevel << " ; After: -O"
                         << NewOptLevel << "\n");
-      SavedFastISel = IS.TM.Options.EnableFastISel;
       if (NewOptLevel == CodeGenOpt::None) {
         IS.TM.setFastISel(IS.TM.getO0WantsFastISel());
         LLVM_DEBUG(


        


More information about the llvm-commits mailing list