[PATCH] D144682: Fix miscompilation from MergeFunctions-Inline-SROA-InstCombine optimization sequence

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 02:24:01 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/FunctionComparator.cpp:589
       return Res;
     return cmpRangeMetadata(
         LI->getMetadata(LLVMContext::MD_range),
----------------
The right position to add the new check would be here. You can see it already handles range metadata. Your test also has align and noundef metadata. At this point, we should generalize this to arbitrary metadata (maybe ignoring debug metadata).


================
Comment at: llvm/test/Transforms/MergeFunc/mergefunc-preserve-nonnull.ll:10
+
+define hidden void @f1(ptr noalias nocapture noundef sret(%1) dereferenceable(24) %0, ptr noalias nocapture noundef dereferenceable(24) %1) unnamed_addr #0 {
+  ; CHECK-LABEL: @f1(
----------------
There are a lot of attributes and instructions in this test that can be dropped -- we don't need much more than the the load instructions that can't be merged. See also https://llvm.org/docs/TestingGuide.html#best-practices-for-regression-tests.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144682/new/

https://reviews.llvm.org/D144682



More information about the llvm-commits mailing list