[PATCH] D79405: [SelectionDAG] Fix assertion failure with big shift amounts

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 12:26:52 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7fa5abd3437e: [SelectionDAG] Fix assertion failure with big shift amounts (authored by LemonBoy, committed by craig.topper).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79405

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/X86/load-local-v3i129.ll


Index: llvm/test/CodeGen/X86/load-local-v3i129.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/load-local-v3i129.ll
@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+
+define void @_start() {
+; CHECK-LABEL: _start:
+; CHECK:       # %bb.0: # %Entry
+; CHECK-NEXT:    pushq %rbp
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NEXT:    .cfi_offset %rbp, -16
+; CHECK-NEXT:    movq %rsp, %rbp
+; CHECK-NEXT:    .cfi_def_cfa_register %rbp
+; CHECK-NEXT:    andq $-128, %rsp
+; CHECK-NEXT:    subq $256, %rsp # imm = 0x100
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; CHECK-NEXT:    movq {{[0-9]+}}(%rsp), %rcx
+; CHECK-NEXT:    shrdq $2, %rcx, %rax
+; CHECK-NEXT:    shrq $2, %rcx
+; CHECK-NEXT:    leaq 1(,%rax,4), %rdx
+; CHECK-NEXT:    movq %rdx, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    shrdq $62, %rcx, %rax
+; CHECK-NEXT:    movq %rax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    orq $-2, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq $-1, {{[0-9]+}}(%rsp)
+; CHECK-NEXT:    movq %rbp, %rsp
+; CHECK-NEXT:    popq %rbp
+; CHECK-NEXT:    .cfi_def_cfa %rsp, 8
+; CHECK-NEXT:    retq
+Entry:
+  %y = alloca <3 x i129>, align 4
+  %L = load <3 x i129>, <3 x i129>* %y
+  %I1 = insertelement <3 x i129> %L, i129 340282366920938463463374607431768211455, i32 1
+  store <3 x i129> %I1, <3 x i129>* %y
+  ret void
+}
Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -6642,8 +6642,8 @@
       unsigned ShiftIntoIdx =
           (DAG.getDataLayout().isBigEndian() ? (NumElem - 1) - Idx : Idx);
       SDValue ShiftAmount =
-          DAG.getConstant(ShiftIntoIdx * SrcEltVT.getSizeInBits(), SL,
-                          getShiftAmountTy(LoadVT, DAG.getDataLayout()));
+          DAG.getShiftAmountConstant(ShiftIntoIdx * SrcEltVT.getSizeInBits(),
+                                     LoadVT, SL, /*LegalTypes=*/false);
       SDValue ShiftedElt = DAG.getNode(ISD::SRL, SL, LoadVT, Load, ShiftAmount);
       SDValue Elt =
           DAG.getNode(ISD::AND, SL, LoadVT, ShiftedElt, SrcEltBitMask);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79405.262449.patch
Type: text/x-patch
Size: 2335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200506/db7f8328/attachment.bin>


More information about the llvm-commits mailing list