]> granicus.if.org Git - llvm/commitdiff
Fix uninitialized access in MachineBlockPlacement.
authorSam McCall <sam.mccall@gmail.com>
Tue, 1 Nov 2016 22:02:14 +0000 (22:02 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 1 Nov 2016 22:02:14 +0000 (22:02 +0000)
Summary:
Currently PreferredLoopExit is set only in buildLoopChains, which is
never called if there are no MachineLoops.

MSan is currently broken by this:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/145/steps/check-llvm%20msan/logs/stdio

This is a naive fix to get things green again. iteratee: you may have a better fix.

This change will also mean PreferredLoopExit will not carry over if
buildCFGChains() is called a second time in runOnMachineFunction, this
appears to be the right thing.

Reviewers: bkramer, iteratee, echristo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285757 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineBlockPlacement.cpp

index b131bbcb3ae806684a8afcb5d6a9bfb6bb0ff8b2..7f7c3d38488bb4f5bd5a60306fef236de45263cf 100644 (file)
@@ -1599,6 +1599,7 @@ void MachineBlockPlacement::buildCFGChains() {
   collectMustExecuteBBs();
 
   // Build any loop-based chains.
+  PreferredLoopExit = nullptr;
   for (MachineLoop *L : *MLI)
     buildLoopChains(*L);