summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-03-30 21:12:06 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-03-30 21:12:06 +0000
commit5d518386b658f51e18e77d31e2f823c171572b71 (patch)
tree651018acda3c8482de9079ca6efdf6dba5085e28 /llvm/test
parentbbaf5e0acf8870dd1b77afeb7ab09bf875d29b01 (diff)
downloadbcm5719-llvm-5d518386b658f51e18e77d31e2f823c171572b71.tar.gz
bcm5719-llvm-5d518386b658f51e18e77d31e2f823c171572b71.zip
[IndVarSimplify] Don't insert after a catchswitch
Widening a PHI requires us to insert a trunc. The logical place for this trunc is in the same BB as the PHI. This is not possible if the BB is terminated by a catchswitch. This fixes PR27133. llvm-svn: 264926
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/IndVarSimplify/pr27133.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/pr27133.ll b/llvm/test/Transforms/IndVarSimplify/pr27133.ll
new file mode 100644
index 00000000000..1262407ea82
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr27133.ll
@@ -0,0 +1,38 @@
+; RUN: opt -indvars -S < %s | FileCheck %s
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc18.0.0"
+
+define i32 @fn2() personality i32 (...)* @__CxxFrameHandler3 {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %c.0 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
+; CHECK: %[[WIDE:.*]] = phi i64
+; CHECK: %[[NORM:.*]] = phi i32
+; CHECK: invoke void @fn1(i64 %[[WIDE]])
+ %idxprom = sext i32 %c.0 to i64
+ invoke void @fn1(i64 %idxprom)
+ to label %for.inc unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %for.cond
+ %c.0.lcssa = phi i32 [ %c.0, %for.cond ]
+; CHECK: %[[LCSSA:.*]] = phi i32 [ %[[NORM]],
+ %0 = catchswitch within none [label %catch] unwind to caller
+
+catch: ; preds = %catch.dispatch
+ %1 = catchpad within %0 [i8* null, i32 64, i8* null]
+ catchret from %1 to label %exit
+
+exit:
+; CHECK: ret i32 %[[LCSSA]]
+ ret i32 %c.0.lcssa
+
+for.inc: ; preds = %for.cond
+ %inc = add nsw nuw i32 %c.0, 1
+ br label %for.cond
+}
+
+declare void @fn1(i64 %idxprom)
+
+declare i32 @__CxxFrameHandler3(...)
OpenPOWER on IntegriCloud