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

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 21:51:14 PDT 2017


nemanjai 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))
----------------
spatel wrote:
> 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.
Ah, OK fair enough. I didn't realize that.


https://reviews.llvm.org/D34071





More information about the llvm-commits mailing list