[llvm] [PPCMergeStringPool] Avoid replacing constant with instruction (PR #88846)
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 00:56:39 PDT 2024
================
@@ -117,9 +118,16 @@ class PPCMergeStringPool : public ModulePass {
// sure that they can be replaced.
static bool hasReplaceableUsers(GlobalVariable &GV) {
for (User *CurrentUser : GV.users()) {
- // Instruction users are always valid.
- if (isa<Instruction>(CurrentUser))
+ if (isa<Instruction>(CurrentUser)) {
+ if (auto *II = dyn_cast<IntrinsicInst>(CurrentUser)) {
+ // Some intrinsics require a plain global.
+ if (II->getIntrinsicID() == Intrinsic::eh_typeid_for)
+ return false;
+ }
+
----------------
chenzheng1030 wrote:
>From https://github.com/llvm/llvm-project/blob/853344d3ae8bb655b2d15175880bd3f65ab66434/llvm/lib/CodeGen/GlobalMerge.cpp#L601-L610, seems the `GlobalVariable` used in eh related instructions are not allowed to replace. Not sure why we don't have similar logic here. @stefanp-ibm do you know why? Thanks.
https://github.com/llvm/llvm-project/pull/88846
More information about the llvm-commits
mailing list