[PATCH] D99845: [GlobalOpt] Delete write-only constants with cast users

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 16:07:47 PDT 2023


arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.
Herald added a subscriber: hoy.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:326-328
+    } else if (CastInst *CI = dyn_cast<CastInst>(U)) {
+      if (CI->getType()->isPointerTy()) {
+        // Pointer cast, delete any stores and memsets to the global.
----------------
This is less useful with pointer bitcasts effectively gone. Is this still interesting if restricted to addrspacecast?


================
Comment at: llvm/test/Transforms/GlobalOpt/writeonly-internal-bitcast.ll:35
   store i32 0, i32* %bc1, align 4
   %g2 = getelementptr inbounds %struct.S, %struct.S* @CastAccessConst, i32 0, i32 1, i32 42
   %bc2 = bitcast i8* %g2 to i32*
----------------
May need a test with addrspacecast


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99845/new/

https://reviews.llvm.org/D99845



More information about the llvm-commits mailing list