mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-02 00:42:52 +01:00
318d9a6605
in addition to integer expressions. Rewrite GetOrEnforceKnownAlignment as a ComputeMaskedBits problem, moving all of its special alignment knowledge to ComputeMaskedBits as low-zero-bits knowledge. Also, teach ComputeMaskedBits a few basic things about Mul and PHI instructions. This improves ComputeMaskedBits-based simplifications in a few cases, but more noticeably it significantly improves instcombine's alignment detection for loads, stores, and memory intrinsics. llvm-svn: 49492
44 lines
1.4 KiB
LLVM
44 lines
1.4 KiB
LLVM
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 16} | count 1
|
|
|
|
; A multi-dimensional array in a nested loop doing vector stores that
|
|
; aren't yet aligned. Instcombine can understand the addressing in the
|
|
; Nice case to prove 16 byte alignment. In the Awkward case, the inner
|
|
; array dimension is not even, so the stores to it won't always be
|
|
; aligned. Instcombine should prove alignment in exactly one of the two
|
|
; stores.
|
|
|
|
@Nice = global [1001 x [20000 x double]] zeroinitializer, align 32
|
|
@Awkward = global [1001 x [20001 x double]] zeroinitializer, align 32
|
|
|
|
define void @foo() nounwind {
|
|
entry:
|
|
br label %bb7.outer
|
|
|
|
bb7.outer:
|
|
%i = phi i64 [ 0, %entry ], [ %indvar.next26, %bb11 ]
|
|
br label %bb1
|
|
|
|
bb1:
|
|
%j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ]
|
|
|
|
%t4 = getelementptr [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j
|
|
%q = bitcast double* %t4 to <2 x double>*
|
|
store <2 x double><double 0.0, double 0.0>, <2 x double>* %q, align 8
|
|
|
|
%s4 = getelementptr [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j
|
|
%r = bitcast double* %s4 to <2 x double>*
|
|
store <2 x double><double 0.0, double 0.0>, <2 x double>* %r, align 8
|
|
|
|
%indvar.next = add i64 %j, 2
|
|
%exitcond = icmp eq i64 %indvar.next, 557
|
|
br i1 %exitcond, label %bb11, label %bb1
|
|
|
|
bb11:
|
|
%indvar.next26 = add i64 %i, 1
|
|
%exitcond27 = icmp eq i64 %indvar.next26, 991
|
|
br i1 %exitcond27, label %return.split, label %bb7.outer
|
|
|
|
return.split:
|
|
ret void
|
|
}
|