[llvm] [InstCombine][NFC] Replace buildAssumeFromKnowledge with CreateAlignmentAssumption (PR #196254)

Nikolas Klauser via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 06:35:28 PDT 2026


================
@@ -3740,15 +3728,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
           /// offset and alignment.
           /// TODO: we can generate a GEP instead of merging the alignment with
           /// the offset.
-          RetainedKnowledge RK{Attribute::Alignment,
-                               MinAlign(Offset, AlignMask + 1), A};
-          if (auto *Replacement =
-                  buildAssumeFromKnowledge(RK, Next, &AC, &DT)) {
-
-            Replacement->insertAfter(II->getIterator());
-            AC.registerAssumption(Replacement);
-          }
-          return RemoveConditionFromAssume(II);
+          Builder.CreateAlignmentAssumption(getDataLayout(), A, AlignMask + 1);
----------------
philnik777 wrote:

I've managed to come up with cases where this causes a miscompile. Though I'm not sure whether this is particularly useful.

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


More information about the llvm-commits mailing list