[PATCH] D64432: [InstCombine] try to narrow a truncated load

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 07:25:32 PDT 2019


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:714
+  Value *Bitcast = Builder.CreateBitCast(X, PtrTy);
+  LoadInst *NarrowLoad = new LoadInst(Bitcast);
+  NarrowLoad->setAlignment(WideLoad->getAlignment());
----------------
lebedev.ri wrote:
> This one is deprecated, let's use the proper one
> ```
> LoadInst *NarrowLoad = new LoadInst(PtrTy, Bitcast);
> ```
This isn't obvious (because there are apparently no header comments for any of these constructors), but the type specified by that 1st parameter is the element type of the loaded value, not the pointer type.


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

https://reviews.llvm.org/D64432





More information about the llvm-commits mailing list