summaryrefslogtreecommitdiff
path: root/test/Transforms/SCCP
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2012-04-27 00:54:36 +0000
committerDan Gohman <gohman@apple.com>2012-04-27 00:54:36 +0000
commit97b44f9b8026fce47c1c882347f88af91c6e74c1 (patch)
tree3b832826f8ead1579261dc3762d99ddefa4c82cf /test/Transforms/SCCP
parentf9f1c7aa89c87a9c8d6b8b317957b24e44f66570 (diff)
downloadllvm-97b44f9b8026fce47c1c882347f88af91c6e74c1.tar.gz
llvm-97b44f9b8026fce47c1c882347f88af91c6e74c1.tar.bz2
llvm-97b44f9b8026fce47c1c882347f88af91c6e74c1.tar.xz
Use ConstantExpr::getExtractElement when constant-folding vectors
instead of getAggregateElement. This has the advantage of being more consistent and allowing higher-level constant folding to procede even if an inner extract element cannot be folded. Make ConstantFoldInstruction call ConstantFoldConstantExpression on the instruction's operands, making it more consistent with ConstantFoldConstantExpression itself. This makes sure that ConstantExprs get TargetData-aware folding before being handed off as operands for further folding. This causes more expressions to be folded, but due to a known shortcoming in constant folding, this currently has the side effect of stripping a few more nuw and inbounds flags in the non-targetdata side of constant-fold-gep.ll. This is mostly harmless. This fixes rdar://11324230. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SCCP')
-rw-r--r--test/Transforms/SCCP/vector-bitcast.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/SCCP/vector-bitcast.ll b/test/Transforms/SCCP/vector-bitcast.ll
new file mode 100644
index 0000000000..b032085083
--- /dev/null
+++ b/test/Transforms/SCCP/vector-bitcast.ll
@@ -0,0 +1,20 @@
+; RUN: opt -sccp -S < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
+
+; CHECK: store volatile <2 x i64> zeroinitializer, <2 x i64>* %p
+; rdar://11324230
+
+define void @foo(<2 x i64>* %p) nounwind {
+entry:
+ br label %while.body.i
+
+while.body.i: ; preds = %while.body.i, %entry
+ %vWorkExponent.i.033 = phi <4 x i32> [ %sub.i.i, %while.body.i ], [ <i32 939524096, i32 939524096, i32 939524096, i32 939524096>, %entry ]
+ %sub.i.i = add <4 x i32> %vWorkExponent.i.033, <i32 -8388608, i32 -8388608, i32 -8388608, i32 -8388608>
+ %0 = bitcast <4 x i32> %sub.i.i to <2 x i64>
+ %and.i119.i = and <2 x i64> %0, zeroinitializer
+ store volatile <2 x i64> %and.i119.i, <2 x i64>* %p
+ br label %while.body.i
+}
+