[llvm] [PPCMergeStringPool] Avoid replacing constant with instruction (PR #88846)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 22:18:30 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;
+      }
+
----------------
nikic wrote:

I went ahead and added the EHPad check while also keeping the explicit eh.typeid.for check. Better safe than sorry...

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


More information about the llvm-commits mailing list