[llvm] [InstCombine] Fold align assume into load's !align metadata if possible. (PR #108958)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 08:26:58 PDT 2024


================
@@ -3095,6 +3096,28 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         MaybeSimplifyHint(OBU.Inputs[0]);
         MaybeSimplifyHint(OBU.Inputs[1]);
       }
+
+      // Try to fold alignment assumption into a load's !align metadata, if the
+      // assumption is valid in the load's context.
+      if (OBU.getTagName() == "align" && OBU.Inputs.size() == 2) {
----------------
goldsteinn wrote:

Is there a reason to only use the alignment assumption and not just add support for this in computeKnownBits and use that?

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


More information about the llvm-commits mailing list