[PATCH] D69656: [IPCP] Bail on extractvalue's with more than 1 index.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 10:57:55 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG677343562428: [IPCP] Bail on extractvalue's with more than 1 index. (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69656

Files:
  llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
  llvm/test/Transforms/IPConstantProp/PR43857.ll


Index: llvm/test/Transforms/IPConstantProp/PR43857.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/IPConstantProp/PR43857.ll
@@ -0,0 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -S -ipconstprop | FileCheck %s
+
+%struct.wobble = type { i32 }
+%struct.zot = type { %struct.wobble, %struct.wobble, %struct.wobble }
+
+declare dso_local fastcc float @bar(%struct.wobble* noalias, <8 x i32>) unnamed_addr
+
+define %struct.zot @widget(<8 x i32> %arg) local_unnamed_addr {
+; CHECK-LABEL: define {{[^@]+}}@widget(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    ret [[STRUCT_ZOT:%.*]] undef
+;
+bb:
+  ret %struct.zot undef
+}
+
+define void @baz(<8 x i32> %arg) local_unnamed_addr {
+; CHECK-LABEL: define {{[^@]+}}@baz(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    [[TMP:%.*]] = call [[STRUCT_ZOT:%.*]] @widget(<8 x i32> [[ARG:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = extractvalue [[STRUCT_ZOT]] %tmp, 0, 0
+; CHECK-NEXT:    ret void
+;
+bb:
+  %tmp = call %struct.zot @widget(<8 x i32> %arg)
+  %tmp1 = extractvalue %struct.zot %tmp, 0, 0
+  ret void
+}
Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
===================================================================
--- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -254,7 +254,7 @@
       // Find the index of the retval to replace with
       int index = -1;
       if (ExtractValueInst *EV = dyn_cast<ExtractValueInst>(Ins))
-        if (EV->hasIndices())
+        if (EV->getNumIndices() == 1)
           index = *EV->idx_begin();
 
       // If this use uses a specific return value, and we have a replacement,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69656.227314.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191031/7095ec2e/attachment.bin>


More information about the llvm-commits mailing list