[PATCH] D73288: [InstCombine] Move negation handling into freelyNegateValue()

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 09:03:59 PST 2020


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:867
+  unsigned BitWidth = V->getType()->getScalarSizeInBits();
+  if (match(V, m_ZExt(m_Value(A)))) {
+    // 0-(zext i1 A)  =>  sext i1 A
----------------
Seems like this would be more efficient as a "switch(V->getOpcode())"? 

Then, we could combine cases like ashr/lshr by using Builder.CreateBinOp(V->getOpcode()...). Similarly combine zext/sext with Builder.CreateCast().


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73288/new/

https://reviews.llvm.org/D73288





More information about the llvm-commits mailing list