[PATCH] D73875: [DAG] OptLevelChanger - fix uninitialized variable analyzer warning

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 04:34:06 PST 2020


RKSimon created this revision.
RKSimon added reviewers: probinson, dsanders, niravd.
Herald added subscribers: dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware, hiraditya.
Herald added a project: LLVM.

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73875

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -215,6 +215,7 @@
     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 @@
                         << 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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73875.242023.patch
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200203/84d3e37a/attachment.bin>


More information about the llvm-commits mailing list