[PATCH] D17878: Fix DivRem DAGCombine not to assume div/rem type is simple

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 13:28:26 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL262746: [DAGCombine] Fix divrem combine not to assume div/rem type is simple. (authored by mkuper).

Changed prior to commit:
  http://reviews.llvm.org/D17878?vs=49800&id=49849#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17878

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/trunk/test/CodeGen/X86/pr26835.ll

Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2138,7 +2138,10 @@
 static bool isDivRemLibcallAvailable(SDNode *Node, bool isSigned,
                                      const TargetLowering &TLI) {
   RTLIB::Libcall LC;
-  switch (Node->getSimpleValueType(0).SimpleTy) {
+  EVT NodeType = Node->getValueType(0);
+  if (!NodeType.isSimple())
+    return false;
+  switch (NodeType.getSimpleVT().SimpleTy) {
   default: return false; // No libcall for vector types.
   case MVT::i8:   LC= isSigned ? RTLIB::SDIVREM_I8  : RTLIB::UDIVREM_I8;  break;
   case MVT::i16:  LC= isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16; break;
Index: llvm/trunk/test/CodeGen/X86/pr26835.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/pr26835.ll
+++ llvm/trunk/test/CodeGen/X86/pr26835.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-linux"
+
+; CHECK-LABEL: foo
+; CHECK: div
+define i24 @foo(i24 %a, i24 %b) {
+  %r = urem i24 %a, %b
+  ret i24 %r
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17878.49849.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160304/46587921/attachment.bin>


More information about the llvm-commits mailing list