[PATCH] D64432: [InstCombine] try to narrow a truncated load
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 05:09:43 PDT 2019
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
LGTM with `dereferenceable()` restriction, but maybe wait for one more review.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:714
+ Value *Bitcast = Builder.CreateBitCast(X, PtrTy);
+ LoadInst *NarrowLoad = new LoadInst(Bitcast);
+ NarrowLoad->setAlignment(WideLoad->getAlignment());
----------------
This one is deprecated, let's use the proper one
```
LoadInst *NarrowLoad = new LoadInst(PtrTy, Bitcast);
```
================
Comment at: llvm/test/Transforms/InstCombine/trunc-load.ll:5
-define i32 @truncload(i64* %ptr) {
-; CHECK-LABEL: @truncload(
+; Don't narrow if it would lose information about the dereferenceable range of the pointer.
+
----------------
Please precommit the tests.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64432/new/
https://reviews.llvm.org/D64432
More information about the llvm-commits
mailing list