[PATCH] D34071: [CGP, PowerPC] try to constant fold before creating loads for memcmp expansion

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 21:22:24 PDT 2017


spatel added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:1855
+    // Get a constant or load a value for each source address.
+    Value *LoadSrc1 = nullptr;
+    if (auto *Source1C = dyn_cast<Constant>(Source1))
----------------
nemanjai wrote:
> I think this would read nicer if we just had the `dyn_cast<Constant>` and then just initialized `LoadSrc1` with a ternary operator.
> But that's just a thought.
That would mean that if the pointer is a constant, then ConstantFoldLoadFromConstPtr always succeeds. But I don't think we can make that assumption.


https://reviews.llvm.org/D34071





More information about the llvm-commits mailing list