[llvm] [RFC] Memory Model Relaxation Annotations (PR #78569)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 02:50:07 PST 2024


================
@@ -698,6 +700,16 @@ bool Instruction::hasSameSpecialState(const Instruction *I2,
   assert(I1->getOpcode() == I2->getOpcode() &&
          "Can not compare special state of different instructions");
 
+  // MMRAs may change semantics of an operation, e.g. make a fence only
+  // affect a given address space.
+  //
+  // FIXME: Not sure if this stinks or not. Maybe we should just look at
+  // all callers and make them check MMRAs.
+  // OTOH, MMRAs can really alter semantics so this is technically correct
+  // (the best kind of correct).
+  if (MMRAMetadata(*this) != MMRAMetadata(*I2))
----------------
Pierre-vh wrote:

This is something I'm unsure about. It doesn't feel like the right place to put this, but it kind of makes sense to put here given how MMRAs work?

Maybe it should check for compatibility instead? (@sameerds)

This is what prevents SimplifyCFG from merging common code. GVN does it though because it doesn't seem to use this function.

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


More information about the llvm-commits mailing list