Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
Analysis
AliasSet
AssumptionCache
BasicAA
BlockFrequencyInfo
BranchProbabilityInfo
CFLAliasAnalysis
CallGraph
ConstantFolding
CostModel
Delinearization
DemandedBits
DependenceAnalysis
Banerjee.ll
BasePtrBug.ll
Constraints.ll
Coupled.ll
ExactRDIV.ll
ExactSIV.ll
GCD.ll
Invariant.ll
MIVCheckConst.ll
NonAffineExpr.ll
NonCanonicalizedSubscript.ll
PR21585.ll
Preliminary.ll
Propagating.ll
Separability.ll
StrongSIV.ll
SymbolicRDIV.ll
SymbolicSIV.ll
UsefulGEP.ll
WeakCrossingSIV.ll
WeakZeroDstSIV.ll
WeakZeroSrcSIV.ll
ZIV.ll
DivergenceAnalysis
DominanceFrontier
Dominators
GlobalsModRef
IVUsers
LazyCallGraph
LazyValueAnalysis
Lint
LoopAccessAnalysis
LoopInfo
MemoryDependenceAnalysis
MemorySSA
PostDominators
ProfileSummary
RegionInfo
ScalarEvolution
ScopedNoAliasAA
TypeBasedAliasAnalysis
ValueTracking
alias-analysis-uses.ll
Assembler
Bindings
Bitcode
BugPoint
CodeGen
DebugInfo
Examples
ExecutionEngine
Feature
FileCheck
Instrumentation
Integer
JitListener
LTO
Linker
MC
Object
ObjectYAML
Other
SafepointIRVerifier
SymbolRewriter
TableGen
ThinLTO
Transforms
Unit
Verifier
YAMLParser
tools
.clang-format
CMakeLists.txt
TestRunner.sh
lit.cfg.py
lit.site.cfg.py.in
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
libgc
llvm
m4
man
mcs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/external/llvm/test/Analysis/DependenceAnalysis/BasePtrBug.ll

81 lines
1.9 KiB
LLVM
Raw Normal View History

; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; Test that the dependence analysis generates the correct results when using
; an aliased object that points to a different element in the same array.
; PR33567 - https://bugs.llvm.org/show_bug.cgi?id=33567
; void test1(int *A, int *B, int N) {
; int *top = A;
; int *bot = A + N/2;
; for (int i = 0; i < N; i++)
; B[i] = top[i] + bot[i];
; }
; CHECK-LABEL: test1
; CHECK: da analyze - input [*|<]!
define void @test1(i32* nocapture %A, i32* nocapture %B, i32 %N) #0 {
entry:
%cmp9 = icmp sgt i32 %N, 0
br i1 %cmp9, label %for.body.lr.ph, label %for.end
for.body.lr.ph:
%div = sdiv i32 %N, 2
%bot.gep = getelementptr i32, i32* %A, i32 %div
br label %for.body
for.body:
%i = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%gep.0 = getelementptr i32, i32* %A, i32 %i
%gep.1 = getelementptr i32, i32* %bot.gep, i32 %i
%gep.B = getelementptr i32, i32* %B, i32 %i
%0 = load i32, i32* %gep.0, align 4
%1 = load i32, i32* %gep.1, align 4
%add = add nsw i32 %1, %0
store i32 %add, i32* %gep.B, align 4
%inc = add nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, %N
br i1 %exitcond, label %for.end, label %for.body
for.end:
ret void
}
; void test2(int *A, unsigned n) {
; int *B = A + 1;
; for (unsigned i = 0; i < n; ++i) {
; A[i] = B[i];
; }
; }
; CHECK-LABEL: test2
; CHECK: da analyze - consistent anti [1]!
define void @test2(i32*, i32) #3 {
%3 = getelementptr inbounds i32, i32* %0, i64 1
br label %4
; <label>:4:
%.0 = phi i32 [ 0, %2 ], [ %14, %13 ]
%5 = sub i32 %1, 1
%6 = icmp ult i32 %.0, %5
br i1 %6, label %7, label %15
; <label>:7:
%8 = zext i32 %.0 to i64
%9 = getelementptr inbounds i32, i32* %3, i64 %8
%10 = load i32, i32* %9, align 4
%11 = zext i32 %.0 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 %10, i32* %12, align 4
br label %13
; <label>:13:
%14 = add i32 %.0, 1
br label %4
; <label>:15:
ret void
}