[llvm] r281095 - Create phi nodes for swifterror values at the end of the phi instructions list
Arnold Schwaighofer via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 14:18:47 PDT 2016
Author: arnolds
Date: Fri Sep 9 16:18:47 2016
New Revision: 281095
URL: http://llvm.org/viewvc/llvm-project?rev=281095&view=rev
Log:
Create phi nodes for swifterror values at the end of the phi instructions list
ISel makes assumption about the order of phi nodes.
rdar://28190150
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/test/CodeGen/X86/swifterror.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=281095&r1=281094&r2=281095&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Sep 9 16:18:47 2016
@@ -1253,7 +1253,7 @@ static void mergeIncomingSwiftErrors(Fun
FuncInfo->SwiftErrorMap[FuncInfo->MBB].push_back(VReg);
MachineInstrBuilder SwiftErrorPHI = BuildMI(*FuncInfo->MBB,
- FuncInfo->MBB->begin(), SDB->getCurDebugLoc(),
+ FuncInfo->InsertPt, SDB->getCurDebugLoc(),
TII->get(TargetOpcode::PHI), VReg);
for (const_pred_iterator PI = pred_begin(LLVMBB), PE = pred_end(LLVMBB);
PI != PE; ++PI) {
Modified: llvm/trunk/test/CodeGen/X86/swifterror.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/swifterror.ll?rev=281095&r1=281094&r2=281095&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/swifterror.ll (original)
+++ llvm/trunk/test/CodeGen/X86/swifterror.ll Fri Sep 9 16:18:47 2016
@@ -357,3 +357,22 @@ handler2:
ret float 1.0
}
+
+%swift.refcounted = type opaque
+
+; This test checks that we don't create bad phi nodes as part of swifterror
+; isel. We used to fail machine ir verification.
+; CHECK-APPLE: _swifterror_isel
+; CHECK-O0: _swifterror_isel
+define void @swifterror_isel(%swift.refcounted*) {
+entry:
+ %swifterror = alloca swifterror %swift_error*, align 8
+ br i1 undef, label %5, label %1
+
+ %2 = phi i16 [ %4, %1 ], [ undef, %entry ]
+ %3 = call i1 undef(i16 %2, %swift.refcounted* swiftself %0, %swift_error** nocapture swifterror %swifterror)
+ %4 = load i16, i16* undef, align 2
+ br label %1
+
+ ret void
+}
More information about the llvm-commits
mailing list