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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 06:05:01 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/FunctionComparator.cpp:222
+  }
+  return 0;
+}
----------------
There is more metadata that applies to loads. I can think of `!align`, `!tbaa`, `!alias.scope`, `!noalias`, `!llvm.mem.parallel.loop.access` and `!llvm.access.group`.

This is why I suggested to compare all metadata and only skip some white-listed cases like `!dbg`. Otherwise we are likely to miss something here, especially also if new metadata is added in the future.


================
Comment at: llvm/test/Transforms/MergeFunc/mergefunc-preserve-nonnull.ll:1
+; RUN: opt -passes=mergefunc -S < %s | FileCheck %s
+
----------------
Please use `update_test_checks.py`.


================
Comment at: llvm/test/Transforms/MergeFunc/mergefunc-preserve-nonnull.ll:6
+
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
----------------
Is this line needed?


================
Comment at: llvm/test/Transforms/MergeFunc/mergefunc-preserve-nonnull.ll:10
+
+define void @f1(ptr noalias nocapture noundef sret(%1) dereferenceable(8) %0, ptr noalias nocapture noundef dereferenceable(24) %1) {
+  ; CHECK-LABEL: @f1(
----------------
You should be able to drop all the attributes (noalias etc).


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

https://reviews.llvm.org/D144682



More information about the llvm-commits mailing list