[PATCH] D98588: [InstCombine] Restrict a GEP transform to avoid changing provenance

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 13 12:03:21 PST 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2181-2185
+      if (Matched &&
+          match(V, m_Sub(m_PtrToInt(m_Value(Y)), m_PtrToInt(m_Specific(X))))) {
+        if (getUnderlyingObject(X) == getUnderlyingObject(Y))
           return CastInst::CreatePointerBitCastOrAddrSpaceCast(Y, GEPType);
       }
----------------



================
Comment at: llvm/test/Transforms/InstCombine/getelementptr.ll:1
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -instcombine -S | FileCheck %s
----------------
Please regenerate check lines without this patch and precommit that.


================
Comment at: llvm/test/Transforms/InstCombine/getelementptr.ll:1292
 
+define i8* @D_TBD(i8* %c1, i64 %offset) {
+; CHECK-LABEL: @D_TBD(
----------------
nagisa wrote:
> This is a newly added test. This does not optimize at all with -O3 if we remove the transform in question.
Please precommit the test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98588



More information about the llvm-commits mailing list