[PATCH] D59703: Convert a masked.load of a dereferenceable address to an unconditional load

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 14:14:23 PDT 2019


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM. This canonicalization is reverse of the typical (shorter code is preferred), but the reasoning in the summary makes sense: we have lots of IR optimizer logic for selects, and this should be reversible in the backend.



================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1183
+  // If we can unconditionally load from this address, replace with a
+  // load/select idiom. TODO: use DT for context sensative query
+  if (isDereferenceableAndAlignedPointer(LoadPtr, Alignment,
----------------
typo: sensative


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1187
+                                         &II, nullptr)) {
+    auto *LI = Builder.CreateAlignedLoad(II.getType(), LoadPtr, Alignment,
+                                         "unmaskedload");
----------------
I think LLVM standards prefer to make this an explicit "Value *" rather than "auto *":
http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable


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

https://reviews.llvm.org/D59703





More information about the llvm-commits mailing list