[llvm] [SimplifyCFG] Drop UB-implying metadata when hoisting past side effects (PR #226746)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 09:05:45 PDT 2026
================
@@ -2053,6 +2053,20 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(Instruction *TI,
I1->applyMergedLocation(I1->getDebugLoc(), I2->getDebugLoc());
I2->eraseFromParent();
}
+ // I1 now executes before the instructions we skipped.
+ unsigned SkippedFlags = 0;
+ for (const SuccIterPair &P : SuccIterPairs)
+ SkippedFlags |= P.second;
+ if (SkippedFlags & SkipImplicitControlFlow) {
+ // One of them may throw or not return, so I1 is speculated.
+ I1->dropUBImplyingAttrsAndMetadata();
----------------
nikic wrote:
This bit looks fine.
https://github.com/llvm/llvm-project/pull/226746
More information about the llvm-commits
mailing list