summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorLeo Li <aoli@google.com>2017-07-06 18:47:05 +0000
committerLeo Li <aoli@google.com>2017-07-06 18:47:05 +0000
commit5499b1b8be180a34ed530fc8048e867371af1a24 (patch)
treef17c9f490fa368f651dca2889ea51e3c884531ea /llvm/test/Transforms
parentca2c87653cfd6831124d654617950d1e906cadb8 (diff)
downloadbcm5719-llvm-5499b1b8be180a34ed530fc8048e867371af1a24.tar.gz
bcm5719-llvm-5499b1b8be180a34ed530fc8048e867371af1a24.zip
Modify constraints in `llvm::canReplaceOperandWithVariable`
Summary: `Instruction::Switch`: only first operand can be set to a non-constant value. `Instruction::InsertValue` both the first and the second operand can be set to a non-constant value. `Instruction::Alloca` return true for non-static allocation. Reviewers: efriedma Reviewed By: efriedma Subscribers: srhines, pirama, llvm-commits Differential Revision: https://reviews.llvm.org/D34905 llvm-svn: 307294
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/sink-common-code.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll
index 0f7bfa8516c..513da477607 100644
--- a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll
+++ b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll
@@ -818,6 +818,30 @@ merge:
; CHECK: right:
; CHECK-NEXT: %val1 = call i32 @call_target() [ "deopt"(i32 20) ]
+%T = type {i32, i32}
+
+define i32 @test_insertvalue(i1 zeroext %flag, %T %P) {
+entry:
+ br i1 %flag, label %if.then, label %if.else
+
+if.then:
+ %t1 = insertvalue %T %P, i32 0, 0
+ br label %if.end
+
+if.else:
+ %t2 = insertvalue %T %P, i32 1, 0
+ br label %if.end
+
+if.end:
+ %t = phi %T [%t1, %if.then], [%t2, %if.else]
+ ret i32 1
+}
+
+; CHECK-LABEL: @test_insertvalue
+; CHECK: select
+; CHECK: insertvalue
+; CHECK-NOT: insertvalue
+
; CHECK: ![[TBAA]] = !{![[TYPE:[0-9]]], ![[TYPE]], i64 0}
; CHECK: ![[TYPE]] = !{!"float", ![[TEXT:[0-9]]]}
; CHECK: ![[TEXT]] = !{!"an example type tree"}
OpenPOWER on IntegriCloud