[llvm] 99254f9 - Revert "[InstCombine] improve efficiency of bool logic; NFC"

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:18:21 PST 2022


Author: Sanjay Patel
Date: 2022-12-08T14:16:46-05:00
New Revision: 99254f925185e18f456821e27a2272136518f9f3

URL: https://github.com/llvm/llvm-project/commit/99254f925185e18f456821e27a2272136518f9f3
DIFF: https://github.com/llvm/llvm-project/commit/99254f925185e18f456821e27a2272136518f9f3.diff

LOG: Revert "[InstCombine] improve efficiency of bool logic; NFC"

This reverts commit b7c7fe3d0779b6e332fe6db64e87561deba2e56a.

As discussed in the planned follow-on to this patch (D138874),
this and the previous patch in this set can cause trouble for
the backend, and there's probably no quick fix. We may even
want to canonicalize in the opposite direction (towards insertelt).

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index ab5c8d41ed5c8..d45b46599f604 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1541,7 +1541,8 @@ static Instruction *foldTruncInsElt(InsertElementInst &InsElt, bool IsBigEndian,
 
   unsigned NumEltsInScalar = ScalarWidth / VecEltWidth;
   Value *X = T;
-  if (IndexC == (IsBigEndian ? NumEltsInScalar - 1 : 0)) {
+  if ((IsBigEndian && IndexC == NumEltsInScalar - 1) ||
+      (!IsBigEndian && IndexC == 0)) {
     // The insert is to the LSB end of the vector (depends on endian).
     // That's all we need.
   } else {


        


More information about the llvm-commits mailing list