[llvm-branch-commits] [llvm] eeb99c2 - Revert "[IROutliner] Adding support for swift errors"

Andrew Litteken via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 29 23:21:53 PST 2020


Author: Andrew Litteken
Date: 2020-12-30T01:17:27-06:00
New Revision: eeb99c2ac2672c8a61085e94f66b1b31c524cd87

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

LOG: Revert "[IROutliner] Adding support for swift errors"

This reverts commit 71867ed5e6606a93f0c1413f205afe3bb16317fe.

Reverting for lack of commit messages.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/IROutliner.cpp

Removed: 
    llvm/test/Transforms/IROutliner/outlining-swift-error.ll


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 5289826f4a9a..d972908f507d 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -81,10 +81,6 @@ struct OutlinableGroup {
   /// Regions.
   unsigned Cost = 0;
 
-  /// The argument that needs to be marked with the swifterr attribute.  If not
-  /// needed, there is no value.
-  Optional<unsigned> SwiftErrorArgument;
-
   /// For the \ref Regions, we look at every Value.  If it is a constant,
   /// we check whether it is the same in Region.
   ///
@@ -356,11 +352,6 @@ Function *IROutliner::createFunction(Module &M, OutlinableGroup &Group,
       Group.OutlinedFunctionType, GlobalValue::InternalLinkage,
       "outlined_ir_func_" + std::to_string(FunctionNameSuffix), M);
 
-  // Transfer the swifterr attribute to the correct function parameter.
-  if (Group.SwiftErrorArgument.hasValue())
-    Group.OutlinedFunction->addParamAttr(Group.SwiftErrorArgument.getValue(),
-                                         Attribute::SwiftError);
-
   Group.OutlinedFunction->addFnAttr(Attribute::OptimizeForSize);
   Group.OutlinedFunction->addFnAttr(Attribute::MinSize);
 
@@ -579,17 +570,8 @@ findExtractedInputToOverallInputMapping(OutlinableRegion &Region,
     assert(InputOpt.hasValue() && "Global value number not found?");
     Value *Input = InputOpt.getValue();
 
-    if (!Group.InputTypesSet) {
+    if (!Group.InputTypesSet)
       Group.ArgumentTypes.push_back(Input->getType());
-      // If the input value has a swifterr attribute, make sure to mark the
-      // argument in the overall function.
-      if (Input->isSwiftError()) {
-        assert(
-            !Group.SwiftErrorArgument.hasValue() &&
-            "Argument already marked with swifterr for this OutlinableGroup!");
-        Group.SwiftErrorArgument = TypeIndex;
-      }
-    }
 
     // Check if we have a constant. If we do add it to the overall argument
     // number to Constant map for the region, and continue to the next input.
@@ -810,12 +792,6 @@ CallInst *replaceCalledFunction(Module &M, OutlinableRegion &Region) {
   OldCall->eraseFromParent();
   Region.Call = Call;
 
-  // Make sure that the argument in the new function has the SwiftError
-  // argument.
-  if (Group.SwiftErrorArgument.hasValue())
-    Call->addParamAttr(Group.SwiftErrorArgument.getValue(),
-                       Attribute::SwiftError);
-
   return Call;
 }
 

diff  --git a/llvm/test/Transforms/IROutliner/outlining-swift-error.ll b/llvm/test/Transforms/IROutliner/outlining-swift-error.ll
deleted file mode 100644
index a6012cdeb329..000000000000
--- a/llvm/test/Transforms/IROutliner/outlining-swift-error.ll
+++ /dev/null
@@ -1,47 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s
-
-%swift.error = type opaque
-
-define void @outlining_swifterror1(%swift.error** swifterror %err) {
-; CHECK-LABEL: @outlining_swifterror1(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[X:%.*]] = alloca i64, align 8
-; CHECK-NEXT:    call void @outlined_ir_func_0(i64 5, i64* [[X]], %swift.error** swifterror [[ERR:%.*]])
-; CHECK-NEXT:    ret void
-;
-entry:
-  %x = alloca i64
-  %0 = mul i64 5, 5
-  %1 = add i64 %0, %0
-  store i64 %1, i64* %x
-  %casted = bitcast i64* %x to %swift.error*
-  store %swift.error* %casted, %swift.error** %err
-  ret void
-}
-
-define void @outlining_swifterror2(%swift.error** swifterror %err) {
-; CHECK-LABEL: @outlining_swifterror2(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[X:%.*]] = alloca i64, align 8
-; CHECK-NEXT:    call void @outlined_ir_func_0(i64 3, i64* [[X]], %swift.error** swifterror [[ERR:%.*]])
-; CHECK-NEXT:    ret void
-;
-entry:
-  %x = alloca i64
-  %0 = mul i64 3, 3
-  %1 = add i64 %0, %0
-  store i64 %1, i64* %x
-  %casted = bitcast i64* %x to %swift.error*
-  store %swift.error* %casted, %swift.error** %err
-  ret void
-}
-
-; CHECK: define internal void @outlined_ir_func_0(i64 [[ARG0:%.*]], i64* [[ARG1:%.*]], %swift.error** swifterror [[ARG2:%.*]])
-; CHECK: entry_to_outline:
-; CHECK-NEXT:  [[TMP0:%.*]] = mul i64 [[ARG0]], [[ARG0]]
-; CHECK-NEXT:  [[TMP1:%.*]] = add i64 [[TMP0]], [[TMP0]]
-; CHECK-NEXT:  store i64 [[TMP1]], i64* [[ARG1]], align 4
-; CHECK-NEXT:  %casted = bitcast i64* [[ARG1]] to %swift.error*
-; CHECK-NEXT:  store %swift.error* %casted, %swift.error** [[ARG2]], align 8
-; CHECK-NEXT:  br label %entry_after_outline.exitStub


        


More information about the llvm-branch-commits mailing list