[PATCH] D91343: [InstCombine] Optimize away the unnecessary multi-use sign-extend

Bhramar Vatsa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 06:51:30 PST 2020


Bhramar.vatsa marked an inline comment as done.
Bhramar.vatsa added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:922-925
+    // If this user is only demanding bits that we know, return the known
+    // constant.
+    if (DemandedMask.isSubsetOf(Known.Zero | Known.One))
+      return Constant::getIntegerValue(ITy, Known.One);
----------------
jeroen.dobbelaere wrote:
> Maybe this should be moved between line 904 and 906 ? (After the computKnownBits, but before checking the signextend pattern). This brings it more in line how the other cases are handled, preferring to return a constant when that is possible.
> 
Yes, I agree.


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

https://reviews.llvm.org/D91343



More information about the llvm-commits mailing list