[llvm] [GlobalOpt] add support for CallInst and InvokeInst users (PR #221955)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 04:03:27 PDT 2026


================
@@ -865,7 +865,8 @@ static bool OptimizeAwayTrappingUsesOfLoads(
               isa<ConstantExpr>(GlobalUser) || isa<CmpInst>(GlobalUser) ||
               isa<BitCastInst>(GlobalUser) ||
               isa<GetElementPtrInst>(GlobalUser) ||
-              isa<AddrSpaceCastInst>(GlobalUser)) &&
+              isa<AddrSpaceCastInst>(GlobalUser) || isa<CallInst>(GlobalUser) ||
+              isa<InvokeInst>(GlobalUser)) &&
----------------
nikic wrote:

So if I understand correctly, this got out of sync with the analysis in GlobalStatus, which supports MemTransferInst?

TBH I'm not sure I see the value in this list, and would probably just go ahead and delete the whole assert. At least I don't get what this is really guarding against, the code should be conservatively correct even if it hits something unexpected.

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


More information about the llvm-commits mailing list