summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify/cast.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstSimplify/cast.ll')
-rw-r--r--llvm/test/Transforms/InstSimplify/cast.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/cast.ll b/llvm/test/Transforms/InstSimplify/cast.ll
new file mode 100644
index 00000000000..a656854478d
--- /dev/null
+++ b/llvm/test/Transforms/InstSimplify/cast.ll
@@ -0,0 +1,27 @@
+; RUN: opt -S -instsimplify < %s | FileCheck %s
+
+define i1 @test1(i1 %V) {
+entry:
+ %Z = zext i1 %V to i32
+ %T = trunc i32 %Z to i1
+ ret i1 %T
+; CHECK-LABEL: define i1 @test1(
+; CHECK: ret i1 %V
+}
+
+define i8* @test2(i8* %V) {
+entry:
+ %BC1 = bitcast i8* %V to i32*
+ %BC2 = bitcast i32* %BC1 to i8*
+ ret i8* %BC2
+; CHECK-LABEL: define i8* @test2(
+; CHECK: ret i8* %V
+}
+
+define i8* @test3(i8* %V) {
+entry:
+ %BC = bitcast i8* %V to i8*
+ ret i8* %BC
+; CHECK-LABEL: define i8* @test3(
+; CHECK: ret i8* %V
+}
OpenPOWER on IntegriCloud