forked from OSchip/llvm-project
				
			
		
			
				
	
	
		
			509 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			LLVM
		
	
	
	
			
		
		
	
	
			509 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			LLVM
		
	
	
	
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -verify -S | FileCheck %s
 | 
						|
;
 | 
						|
; Alias check: check that the rewrite isn't triggered when there's a store
 | 
						|
; instruction possibly aliasing any mul load operands; arguments are passed
 | 
						|
; without 'restrict' enabled.
 | 
						|
;
 | 
						|
; CHECK-NOT:  call i32 @llvm.arm.smlad
 | 
						|
;
 | 
						|
define dso_local i32 @no_restrict(i32 %arg, i32* nocapture %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
 | 
						|
; Store inserted here, aliasing with arrayidx, arrayidx1, arrayidx3
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; Alias check: check that the rewrite isn't triggered when there's a store
 | 
						|
; aliasing one of the mul load operands. Arguments are now annotated with
 | 
						|
; 'noalias'.
 | 
						|
;
 | 
						|
; CHECK-NOT:  call i32 @llvm.arm.smlad
 | 
						|
;
 | 
						|
define dso_local i32 @restrict(i32 %arg, i32* noalias %arg1, i16* noalias readonly %arg2, i16* noalias readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
 | 
						|
; Store inserted here, aliasing only with loads from 'arrayidx'.
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
 | 
						|
; Here the Mul is the LHS, and the Add the RHS.
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_dominates_all
 | 
						|
; CHECK: store
 | 
						|
; CHECK: load
 | 
						|
; CHECK: load
 | 
						|
; CHECK: load
 | 
						|
; CHECK: load
 | 
						|
; CHECK: smlad
 | 
						|
define dso_local i32 @store_dominates_all(i32 %arg, i32* nocapture %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: loads_dominate
 | 
						|
; CHECK-NOT: store 
 | 
						|
; CHECK: load i32
 | 
						|
; CHECK-NOT: store
 | 
						|
; CHECK: load i32
 | 
						|
; CHECK: store
 | 
						|
define dso_local i32 @loads_dominate(i32 %arg, i32* nocapture %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg3_legal_1
 | 
						|
; CHECK-NOT: store
 | 
						|
; CHECK: phi i32
 | 
						|
; CHECK: [[IV:%[^ ]+]] = phi i32 [ %add
 | 
						|
; CHECK: [[ARG3_GEP:%[^ ]+]] = getelementptr inbounds i16, i16* %arg3, i32 [[IV]]
 | 
						|
; CHECK: [[ARG3:%[^ ]+]] = bitcast i16* [[ARG3_GEP]] to i32*
 | 
						|
; CHECK: load i32, i32* [[ARG3]]
 | 
						|
; CHECK: [[ARG2_GEP:%[^ ]+]] = getelementptr inbounds i16, i16* %arg2, i32 [[IV]]
 | 
						|
; CHECK: [[ARG2:%[^ ]+]] = bitcast i16* [[ARG2_GEP]] to i32*
 | 
						|
; CHECK: load i32, i32* [[ARG2]]
 | 
						|
; CHECK: store
 | 
						|
define dso_local i32 @store_alias_arg3_legal_1(i32 %arg, i32* nocapture %arg1, i16* noalias nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg3_legal_2
 | 
						|
; CHECK-NOT: store
 | 
						|
; CHECK: [[BITCAST:[^ ]+]] = bitcast i16* %arrayidx to i32*
 | 
						|
; CHECK: load i32, i32* [[BITCAST]]
 | 
						|
; CHECK: store i16 42, i16* %arrayidx
 | 
						|
; CHECK: [[BITCAST3:[^ ]+]] = bitcast i16* %arrayidx3 to i32*
 | 
						|
; CHECK: load i32, i32* [[BITCAST3]]
 | 
						|
; CHECK: smlad
 | 
						|
define dso_local i32 @store_alias_arg3_legal_2(i32 %arg, i32* nocapture %arg1, i16* noalias nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg3_illegal_1
 | 
						|
; CHECK-NOT: load i32
 | 
						|
define dso_local i32 @store_alias_arg3_illegal_1(i32 %arg, i32* nocapture %arg1, i16* noalias nocapture readonly %arg2, i16* noalias nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  store i16 42, i16* %arrayidx1, align 2
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg3_illegal_2
 | 
						|
; CHECK-NOT: load i32
 | 
						|
define dso_local i32 @store_alias_arg3_illegal_2(i32 %arg, i32* nocapture %arg1, i16* noalias nocapture readonly %arg2, i16* noalias nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  store i16 42, i16* %arrayidx, align 2
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg2_illegal_1
 | 
						|
; CHECK-NOT: load i32
 | 
						|
define dso_local i32 @store_alias_arg2_illegal_1(i32 %arg, i32* nocapture %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  store i16 42, i16* %arrayidx6, align 2
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; CHECK-LABEL: store_alias_arg2_illegal_2
 | 
						|
; CHECK-NOT: load i32
 | 
						|
define dso_local i32 @store_alias_arg2_illegal_2(i32 %arg, i32* nocapture %arg1, i16* nocapture readonly %arg2, i16* nocapture readonly %arg3) {
 | 
						|
entry:
 | 
						|
  %cmp24 = icmp sgt i32 %arg, 0
 | 
						|
  br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
 | 
						|
 | 
						|
for.body.preheader:
 | 
						|
  %.pre = load i16, i16* %arg3, align 2
 | 
						|
  %.pre27 = load i16, i16* %arg2, align 2
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:
 | 
						|
  %mac1.0.lcssa = phi i32 [ 0, %entry ], [ %add11, %for.body ]
 | 
						|
  ret i32 %mac1.0.lcssa
 | 
						|
 | 
						|
for.body:
 | 
						|
  %mac1.026 = phi i32 [ %add11, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %i.025 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %arg3, i32 %i.025
 | 
						|
  %0 = load i16, i16* %arrayidx, align 2
 | 
						|
  %add = add nuw nsw i32 %i.025, 1
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %arg3, i32 %add
 | 
						|
  %1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  %arrayidx3 = getelementptr inbounds i16, i16* %arg2, i32 %i.025
 | 
						|
  %2 = load i16, i16* %arrayidx3, align 2
 | 
						|
  %conv = sext i16 %2 to i32
 | 
						|
  %conv4 = sext i16 %0 to i32
 | 
						|
  %mul = mul nsw i32 %conv, %conv4
 | 
						|
  %arrayidx6 = getelementptr inbounds i16, i16* %arg2, i32 %add
 | 
						|
  store i16 42, i16* %arrayidx3, align 2
 | 
						|
  %3 = load i16, i16* %arrayidx6, align 2
 | 
						|
  %conv7 = sext i16 %3 to i32
 | 
						|
  %conv8 = sext i16 %1 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv7, %conv8
 | 
						|
  %add10 = add i32 %mul, %mac1.026
 | 
						|
  %add11 = add i32 %mul9, %add10
 | 
						|
  %exitcond = icmp ne i32 %add, %arg
 | 
						|
  br i1 %exitcond, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 | 
						|
; TODO: I think we should be able to generate one smlad here. The search fails
 | 
						|
; when it finds the alias.
 | 
						|
; CHECK-LABEL: one_pair_alias
 | 
						|
; CHECK-NOT: call i32 @llvm.arm.smlad
 | 
						|
define i32 @one_pair_alias(i16* noalias nocapture readonly %b, i16* noalias nocapture readonly %c) {
 | 
						|
entry:
 | 
						|
  br label %for.body
 | 
						|
 | 
						|
for.cond.cleanup:                                 ; preds = %for.body
 | 
						|
  ret i32 %add26
 | 
						|
 | 
						|
for.body:                                         ; preds = %for.body, %entry
 | 
						|
  %i.050 = phi i32 [ 0, %entry ], [ %add27, %for.body ]
 | 
						|
  %a.049 = phi i32 [ 0, %entry ], [ %add26, %for.body ]
 | 
						|
  %add3 = or i32 %i.050, 1
 | 
						|
  %add11 = or i32 %i.050, 2
 | 
						|
  %add19 = or i32 %i.050, 3
 | 
						|
  %arrayidx = getelementptr inbounds i16, i16* %b, i32 %i.050
 | 
						|
  %arrayidx4 = getelementptr inbounds i16, i16* %b, i32 %add3
 | 
						|
  %arrayidx12 = getelementptr inbounds i16, i16* %b, i32 %add11
 | 
						|
  %arrayidx20 = getelementptr inbounds i16, i16* %b, i32 %add19
 | 
						|
  %arrayidx1 = getelementptr inbounds i16, i16* %c, i32 %i.050
 | 
						|
  %arrayidx7 = getelementptr inbounds i16, i16* %c, i32 %add3
 | 
						|
  %arrayidx15 = getelementptr inbounds i16, i16* %c, i32 %add11
 | 
						|
  %arrayidx23 = getelementptr inbounds i16, i16* %c, i32 %add19
 | 
						|
  %tmp = load i16, i16* %arrayidx, align 2
 | 
						|
  %tmp2 = load i16, i16* %arrayidx4, align 2
 | 
						|
  %tmp4 = load i16, i16* %arrayidx12, align 2
 | 
						|
  %tmp6 = load i16, i16* %arrayidx20, align 2
 | 
						|
  %tmp1 = load i16, i16* %arrayidx1, align 2
 | 
						|
  store i16 43, i16 *%arrayidx7
 | 
						|
  %tmp3 = load i16, i16* %arrayidx7, align 2
 | 
						|
  %tmp5 = load i16, i16* %arrayidx15, align 2
 | 
						|
  %tmp7 = load i16, i16* %arrayidx23, align 2
 | 
						|
  %conv = sext i16 %tmp to i32
 | 
						|
  %conv2 = sext i16 %tmp1 to i32
 | 
						|
  %mul = mul nsw i32 %conv2, %conv
 | 
						|
  %add = add nsw i32 %mul, %a.049
 | 
						|
  %conv5 = sext i16 %tmp2 to i32
 | 
						|
  %conv8 = sext i16 %tmp3 to i32
 | 
						|
  %mul9 = mul nsw i32 %conv8, %conv5
 | 
						|
  %add10 = add nsw i32 %add, %mul9
 | 
						|
  %conv13 = sext i16 %tmp4 to i32
 | 
						|
  %conv16 = sext i16 %tmp5 to i32
 | 
						|
  %mul17 = mul nsw i32 %conv16, %conv13
 | 
						|
  %add18 = add nsw i32 %add10, %mul17
 | 
						|
  %conv21 = sext i16 %tmp6 to i32
 | 
						|
  %conv24 = sext i16 %tmp7 to i32
 | 
						|
  %mul25 = mul nsw i32 %conv24, %conv21
 | 
						|
  %add26 = add nsw i32 %add18, %mul25
 | 
						|
  %add27 = add nuw nsw i32 %i.050, 4
 | 
						|
  %cmp = icmp ult i32 %add27, 100
 | 
						|
  br i1 %cmp, label %for.body, label %for.cond.cleanup
 | 
						|
}
 | 
						|
 |