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

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 13:35:45 PST 2015


mcrosier added a subscriber: mcrosier.

================
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());
----------------
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.


http://reviews.llvm.org/D15618





More information about the llvm-commits mailing list