[PATCH] D36922: [LibCallSimplifier] try harder to fold memcmp with constant arguments

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 13:10:49 PDT 2017


spatel added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp:778
           IntType->getPointerTo(LHS->getType()->getPointerAddressSpace());
+      LHSV = B.CreateLoad(B.CreateBitCast(LHS, LHSPtrTy), "lhsv");
+    }
----------------
efriedma wrote:
> Are you sure this is right?  It looks like it you'll create a dead load if the LHS is aligned, but the RHS isn't (and therefore drive instcombine into an infinite loop).
No - I'm sure this is wrong in exactly the way you've noted. :)
Sorry the review didn't get updated here in Phab, but I reverted this version of the patch at rL311340 and recommitted with a fix and extra test case at rL311366. Please let me know if you see any problems there.


Repository:
  rL LLVM

https://reviews.llvm.org/D36922





More information about the llvm-commits mailing list