[PATCH] D15618: [NaryReassociate] allow candidate to have a different type

Jingyue Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 13:38:07 PST 2015


jingyue added inline comments.

================
Comment at: lib/Transforms/Scalar/NaryReassociate.cpp:432
@@ +431,3 @@
+  // later RAUW doesn't complain.
+  Candidate = Builder.CreateBitOrPointerCast(Candidate, GEP->getType());
+  assert(Candidate->getType() == GEP->getType());
----------------
mcrosier wrote:
> This might be a silly question, but am I correct in assuming the IR builder will just return the Candidate if the types already match?  Hence, the reason we don't need a check prior to the call to CreateBitOrPointerCast.  Of course if we did the check up front we wouldn't need to create the builder...  ..and if the common case is that they do match, then we might consider predicating all this logic.
Right, IRBuilder will just return Candidate if the types already match, so we don't need predicating. 


http://reviews.llvm.org/D15618





More information about the llvm-commits mailing list