[PATCH] D105088: [InstCombine] Fold IntToPtr/PtrToInt to bitcast

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 11:54:40 PDT 2021


efriedma added a comment.

I think you need to check the type of the result of the ptrtoint.  (instcombine will normally canonicalize to have the same width as the pointer type, but that isn't guaranteed to happen before this code runs.)



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4550
+      if (I->getSrcTy() != Op0Ty)
+        NewOp0 = Builder.CreateBitCast(P, Op0Ty);
+      else
----------------
Might as well call CreateBitCast unconditionally; it has the same bailout internally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105088



More information about the llvm-commits mailing list