[llvm] ec37ecb - [LCSSA] Skip updating users in unreachable blocks.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 07:10:23 PDT 2022
Author: Florian Hahn
Date: 2022-08-26T15:09:46+01:00
New Revision: ec37ecbc6299781ebafeaa8a41413d08578577dd
URL: https://github.com/llvm/llvm-project/commit/ec37ecbc6299781ebafeaa8a41413d08578577dd
DIFF: https://github.com/llvm/llvm-project/commit/ec37ecbc6299781ebafeaa8a41413d08578577dd.diff
LOG: [LCSSA] Skip updating users in unreachable blocks.
Don't waste time trying to update users in unreachable blocks.
Added:
Modified:
llvm/lib/Transforms/Utils/LCSSA.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 6de59f9eb533..020a40b229f7 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -111,6 +111,10 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
Instruction *User = cast<Instruction>(U.getUser());
BasicBlock *UserBB = User->getParent();
+ // Skip uses in unreachable blocks.
+ if (!DT.isReachableFromEntry(UserBB))
+ continue;
+
// For practical purposes, we consider that the use in a PHI
// occurs in the respective predecessor block. For more info,
// see the `phi` doc in LangRef and the LCSSA doc.
More information about the llvm-commits
mailing list