summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-02-14 03:23:37 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-02-14 03:23:37 +0000
commit06417743cf04a38d4c016ca74848e164570e6903 (patch)
tree203a262149e1092c89ba78eebaa485674c6211b0 /llvm/test
parent0ac5709027bd71230053115af79f7a426d4862ee (diff)
downloadbcm5719-llvm-06417743cf04a38d4c016ca74848e164570e6903.tar.gz
bcm5719-llvm-06417743cf04a38d4c016ca74848e164570e6903.zip
Teach the DataLayout aware constant folder to be much more aggressive towards
'and' instructions. This is a pattern that shows up a lot in ubsan binaries. llvm-svn: 175128
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll b/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll
new file mode 100644
index 00000000000..9a72c77afdb
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/constant-expr-datalayout.ll
@@ -0,0 +1,12 @@
+; RUN: opt -instcombine %s -S -o - | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%test1.struct = type { i32, i32 }
+@test1.aligned_glbl = global %test1.struct zeroinitializer, align 4
+define void @test1(i64 *%ptr) {
+ store i64 and (i64 ptrtoint (i32* getelementptr (%test1.struct* @test1.aligned_glbl, i32 0, i32 1) to i64), i64 3), i64* %ptr
+; CHECK: store i64 0, i64* %ptr
+ ret void
+}
OpenPOWER on IntegriCloud