[PATCH] D110509: [SelectionDAG] Fix incorrect condition for shift amount truncation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 17:52:57 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7255ce30e48f: [SelectionDAG] Fix incorrect condition for shift amount truncation (authored by nextsilicon-itay-bookstein, committed by craig.topper).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110509

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3146,7 +3146,7 @@
     // count type has enough bits to represent any shift value, truncate
     // it now. This is a common case and it exposes the truncate to
     // optimization early.
-    else if (ShiftSize >= Log2_32_Ceil(Op2.getValueSizeInBits()))
+    else if (ShiftSize >= Log2_32_Ceil(Op1.getValueSizeInBits()))
       Op2 = DAG.getNode(ISD::TRUNCATE, DL, ShiftTy, Op2);
     // Otherwise we'll need to temporarily settle for some other convenient
     // type.  Type legalization will make adjustments once the shiftee is split.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110509.375755.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210929/31b0b1bc/attachment.bin>


More information about the llvm-commits mailing list