[llvm] [StructurizeCFG] Order IF Else block using Heuristics (PR #139605)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 12:03:52 PDT 2025


================
@@ -409,6 +411,31 @@ class StructurizeCFGLegacyPass : public RegionPass {
 
 } // end anonymous namespace
 
+/// Helper function for heuristics to order if else block
+/// Checks whether an instruction is potential vector copy instruction, if so,
+/// checks if the operands are from different BB. if so, returns True.
+// Then there's a possibility of coelescing without interference when ordered
+// first.
+static bool hasAffectingInstructions(Instruction *I, BasicBlock *BB) {
+
+  if (!I || I->getParent() != BB)
+    return true;
+
+  // If the instruction is not a poterntial copy instructoin, return true.
+  if (!isa<ExtractElementInst>(*I) && !isa<ExtractValueInst>(*I))
+    return false;
----------------
arsenm wrote:

Don't understand looking for special case instruction types 

https://github.com/llvm/llvm-project/pull/139605


More information about the llvm-commits mailing list