[llvm][examples][SimplifyCFG] Fix pass's IR changed reporting
authorJon Roelofs <jonathan_roelofs@apple.com>
Mon, 27 Jul 2020 19:37:35 +0000 (13:37 -0600)
committerJon Roelofs <jonathan_roelofs@apple.com>
Mon, 27 Jul 2020 19:39:58 +0000 (13:39 -0600)
... under the EXPENSIVE_CHECKS build, this fails the assert in the LegacyPM
that verifies whether a pass really did leave the IR alone when it reports no
changes back from its return status.

llvm/examples/IRTransforms/SimplifyCFG.cpp

index 10658c9..82368d7 100644 (file)
@@ -354,18 +354,18 @@ static bool mergeIntoSinglePredecessor_v2(Function &F, DominatorTree &DT) {
 }
 
 static bool doSimplify_v1(Function &F) {
-  return eliminateCondBranches_v1(F) & mergeIntoSinglePredecessor_v1(F) &
+  return eliminateCondBranches_v1(F) | mergeIntoSinglePredecessor_v1(F) |
          removeDeadBlocks_v1(F);
 }
 
 static bool doSimplify_v2(Function &F, DominatorTree &DT) {
-  return eliminateCondBranches_v2(F, DT) &
-         mergeIntoSinglePredecessor_v2(F, DT) & removeDeadBlocks_v2(F, DT);
+  return eliminateCondBranches_v2(F, DT) |
+         mergeIntoSinglePredecessor_v2(F, DT) | removeDeadBlocks_v2(F, DT);
 }
 
 static bool doSimplify_v3(Function &F, DominatorTree &DT) {
-  return eliminateCondBranches_v3(F, DT) &
-         mergeIntoSinglePredecessor_v2(F, DT) & removeDeadBlocks_v2(F, DT);
+  return eliminateCondBranches_v3(F, DT) |
+         mergeIntoSinglePredecessor_v2(F, DT) | removeDeadBlocks_v2(F, DT);
 }
 
 namespace {