[llvm] r293656 - [InstCombine] add test for possible zext-phi transform; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 31 09:43:00 PST 2017
Author: spatel
Date: Tue Jan 31 11:43:00 2017
New Revision: 293656
URL: http://llvm.org/viewvc/llvm-project?rev=293656&view=rev
Log:
[InstCombine] add test for possible zext-phi transform; NFC
The datalayout doesn't include i1, so we don't do a potential shrink and sink transform.
Example based on discussion here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109631.html
Added:
llvm/trunk/test/Transforms/InstCombine/zext-phi.ll
Added: llvm/trunk/test/Transforms/InstCombine/zext-phi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/zext-phi.ll?rev=293656&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/zext-phi.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/zext-phi.ll Tue Jan 31 11:43:00 2017
@@ -0,0 +1,29 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-n8:16:32:64"
+
+define i64 @sink_i1_casts(i1 %cond1, i1 %cond2) {
+; CHECK-LABEL: @sink_i1_casts(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[Z1:%.*]] = zext i1 %cond1 to i64
+; CHECK-NEXT: br i1 %cond1, label %if, label %end
+; CHECK: if:
+; CHECK-NEXT: [[Z2:%.*]] = zext i1 %cond2 to i64
+; CHECK-NEXT: br label %end
+; CHECK: end:
+; CHECK-NEXT: [[PHI:%.*]] = phi i64 [ [[Z1]], %entry ], [ [[Z2]], %if ]
+; CHECK-NEXT: ret i64 [[PHI]]
+;
+entry:
+ %z1 = zext i1 %cond1 to i64
+ br i1 %cond1, label %if, label %end
+
+if:
+ %z2 = zext i1 %cond2 to i64
+ br label %end
+
+end:
+ %phi = phi i64 [ %z1, %entry ], [ %z2, %if ]
+ ret i64 %phi
+}
+
More information about the llvm-commits
mailing list