[PATCH] D99121: [IR][InstCombine] IntToPtr Produces Typeless Pointer To Byte

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 23:43:13 PDT 2021


ruiling added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:278-280
+  if (firstOp == Instruction::IntToPtr && secondOp == Instruction::BitCast)
+    Res = 0;
+
----------------
If we want to disable int2ptr + bitcast unconditionally, then why not directly make it in CastInst::isEliminableCastPair()?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1949-1953
+  if (CI.getType() != BytePtrTy) {
+    Value *P = Builder.CreateIntToPtr(CI.getOperand(0), BytePtrTy);
+    return new BitCastInst(P, CI.getType());
+  }
+
----------------
The idea here sounds good to me, but seems causing some new problems for the regression tests. I am not sure the whether the regressions are easy to fix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99121



More information about the llvm-commits mailing list