[PATCH] D98120: [InstCombine] Do not apply provenance losing operations on GEP

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 6 11:21:52 PST 2021


lebedev.ri added a reviewer: lebedev.ri.
lebedev.ri added a comment.

Looks good to me.



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2178-2187
+        // Canonicalize (gepi i8* X, -(ptrtoint Y))
         // to (inttoptr (sub (ptrtoint X), (ptrtoint Y)))
         // The GEP pattern is emitted by the SCEV expander for certain kinds of
         // pointer arithmetic.
         if (match(V, m_Neg(m_PtrToInt(m_Value())))) {
           Operator *Index = cast<Operator>(V);
           Value *PtrToInt = Builder.CreatePtrToInt(PtrOp, Index->getType());
----------------
This whole transform needs to go away, feel free to submit that as a preparatory patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98120



More information about the llvm-commits mailing list