llvm.org GIT mirror llvm / c1be92f
Make BasicAliasAnalysis a normal AliasAnalysis implementation which does normal initialization and normal chaining. Change the default AliasAnalysis implementation to NoAlias. Update StandardCompileOpts.h and friends to explicitly request BasicAliasAnalysis. Update tests to explicitly request -basicaa. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116720 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
81 changed file(s) with 116 addition(s) and 92 deletion(s). Raw diff Collapse all Expand all
7171 static inline void createStandardFunctionPasses(PassManagerBase *PM,
7272 unsigned OptimizationLevel) {
7373 if (OptimizationLevel > 0) {
74 PM->add(createBasicAliasAnalysisPass());
7475 PM->add(createCFGSimplificationPass());
7576 if (OptimizationLevel == 1)
7677 PM->add(createPromoteMemoryToRegisterPass());
9091 bool SimplifyLibCalls,
9192 bool HaveExceptions,
9293 Pass *InliningPass) {
94 PM->add(createBasicAliasAnalysisPass());
95
9396 if (OptimizationLevel == 0) {
9497 if (InliningPass)
9598 PM->add(InliningPass);
176179 bool Internalize,
177180 bool RunInliner,
178181 bool VerifyEach) {
182 // Provide AliasAnalysis services for optimizations.
183 PM->add(createBasicAliasAnalysisPass());
184
179185 // Now that composite has been compiled, scan through the module, looking
180186 // for a main function. If main is defined, mark all other functions
181187 // internal.
189189 char NoAA::ID = 0;
190190 INITIALIZE_AG_PASS(NoAA, AliasAnalysis, "no-aa",
191191 "No Alias Analysis (always returns 'may' alias)",
192 true, true, false)
192 true, true, true)
193193
194194 ImmutablePass *llvm::createNoAAPass() { return new NoAA(); }
195195
491491 static char ID; // Class identification, replacement for typeinfo
492492 BasicAliasAnalysis() : NoAA(ID) {}
493493
494 virtual void initializePass() {
495 InitializeAliasAnalysis(this);
496 }
497
498 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
499 AU.addRequired();
500 }
501
494502 virtual AliasResult alias(const Location &LocA,
495503 const Location &LocB) {
496504 assert(Visited.empty() && "Visited must be cleared after use!");
560568 char BasicAliasAnalysis::ID = 0;
561569 INITIALIZE_AG_PASS(BasicAliasAnalysis, AliasAnalysis, "basicaa",
562570 "Basic Alias Analysis (default AA impl)",
563 false, true, true)
571 false, true, false)
564572
565573 ImmutablePass *llvm::createBasicAliasAnalysisPass() {
566574 return new BasicAliasAnalysis();
577585 // GV may even be a declaration, not a definition.
578586 return GV->isConstant();
579587
580 return NoAA::pointsToConstantMemory(Loc);
588 return AliasAnalysis::pointsToConstantMemory(Loc);
581589 }
582590
583591 /// getModRefBehavior - Return the behavior when calling the given call site.
610618 if (unsigned id = F->getIntrinsicID())
611619 return getIntrinsicModRefBehavior(id);
612620
613 return NoAA::getModRefBehavior(F);
621 return AliasAnalysis::getModRefBehavior(F);
614622 }
615623
616624 /// getModRefInfo - Check to see if the specified callsite can clobber the
10641072 std::swap(V1Size, V2Size);
10651073 std::swap(O1, O2);
10661074 }
1067 if (const GEPOperator *GV1 = dyn_cast(V1))
1068 return aliasGEP(GV1, V1Size, V2, V2Size, O1, O2);
1075 if (const GEPOperator *GV1 = dyn_cast(V1)) {
1076 AliasResult Result = aliasGEP(GV1, V1Size, V2, V2Size, O1, O2);
1077 if (Result != MayAlias) return Result;
1078 }
10691079
10701080 if (isa(V2) && !isa(V1)) {
10711081 std::swap(V1, V2);
10721082 std::swap(V1Size, V2Size);
10731083 }
1074 if (const PHINode *PN = dyn_cast(V1))
1075 return aliasPHI(PN, V1Size, V2, V2Size);
1084 if (const PHINode *PN = dyn_cast(V1)) {
1085 AliasResult Result = aliasPHI(PN, V1Size, V2, V2Size);
1086 if (Result != MayAlias) return Result;
1087 }
10761088
10771089 if (isa(V2) && !isa(V1)) {
10781090 std::swap(V1, V2);
10791091 std::swap(V1Size, V2Size);
10801092 }
1081 if (const SelectInst *S1 = dyn_cast(V1))
1082 return aliasSelect(S1, V1Size, V2, V2Size);
1083
1084 return NoAA::alias(Location(V1, V1Size), Location(V2, V2Size));
1093 if (const SelectInst *S1 = dyn_cast(V1)) {
1094 AliasResult Result = aliasSelect(S1, V1Size, V2, V2Size);
1095 if (Result != MayAlias) return Result;
1096 }
1097
1098 return AliasAnalysis::alias(Location(V1, V1Size), Location(V2, V2Size));
10851099 }
10861100
10871101 // Make sure that anything that uses AliasAnalysis pulls in this file.
1313 #include "llvm/Target/TargetMachine.h"
1414 #include "llvm/PassManager.h"
1515 #include "llvm/Analysis/Verifier.h"
16 #include "llvm/Analysis/Passes.h"
1617 #include "llvm/Assembly/PrintModulePass.h"
1718 #include "llvm/CodeGen/AsmPrinter.h"
1819 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
253254 MCContext *&OutContext) {
254255 // Standard LLVM-Level Passes.
255256
257 // Basic AliasAnalysis support.
258 PM.add(createBasicAliasAnalysisPass());
259
256260 // Before running any passes, run the verifier to determine if the input
257261 // coming from the front-end and/or optimizer is valid.
258262 if (!DisableVerify)
11 ; is performed. It is not legal to delete the second load instruction because
22 ; the value computed by the first load instruction is changed by the store.
33
4 ; RUN: opt < %s -gvn -instcombine -S | grep DONOTREMOVE
4 ; RUN: opt < %s -basicaa -gvn -instcombine -S | grep DONOTREMOVE
55
66 define i32 @test() {
77 %A = alloca i32
None ; RUN: opt < %s -gvn -instcombine -S | grep sub
0 ; RUN: opt < %s -basicaa -gvn -instcombine -S | grep sub
11
22 ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
33
None ; RUN: opt < %s -licm -disable-output
0 ; RUN: opt < %s -basicaa -licm -disable-output
11 %struct..apr_array_header_t = type { i32*, i32, i32, i32, i8* }
22 %struct..apr_table_t = type { %struct..apr_array_header_t, i32, [32 x i32], [32 x i32] }
33
0 ; In this test, a local alloca cannot alias an incoming argument.
11
2 ; RUN: opt < %s -gvn -instcombine -S | not grep sub
2 ; RUN: opt < %s -basicaa -gvn -instcombine -S | not grep sub
33
44 define i32 @test(i32* %P) {
55 %X = alloca i32
0 ; This testcase consists of alias relations which should be completely
11 ; resolvable by basicaa.
22
3 ; RUN: opt < %s -aa-eval -print-may-aliases -disable-output \
3 ; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \
44 ; RUN: |& not grep May:
55
66 %T = type { i32, [10 x i8] }
0 ; This testcase consists of alias relations which should be completely
11 ; resolvable by basicaa, but require analysis of getelementptr constant exprs.
22
3 ; RUN: opt < %s -aa-eval -print-may-aliases -disable-output \
3 ; RUN: opt < %s -basicaa -aa-eval -print-may-aliases -disable-output \
44 ; RUN: |& not grep May:
55
66 %T = type { i32, [10 x i8] }
None ; RUN: opt < %s -dse -S | grep {store i32 0}
0 ; RUN: opt < %s -basicaa -dse -S | grep {store i32 0}
11
22 define void @test({i32,i32 }* %P) {
33 %Q = getelementptr {i32,i32}* %P, i32 1
None ; RUN: opt < %s -licm
0 ; RUN: opt < %s -basicaa -licm
11
22 %"java/lang/Object" = type { %struct.llvm_java_object_base }
33 %"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
None ; RUN: opt < %s -dse
0 ; RUN: opt < %s -basicaa -dse
11
22 %"java/lang/Object" = type { %struct.llvm_java_object_base }
33 %"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
None ; RUN: opt < %s -aa-eval -disable-output |& grep {2 no alias respon}
0 ; RUN: opt < %s -basicaa -aa-eval -disable-output |& grep {2 no alias respon}
11 ; TEST that A[1][0] may alias A[0][i].
22 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
33
None ; RUN: opt < %s -licm -disable-output
0 ; RUN: opt < %s -basicaa -licm -disable-output
11 target datalayout = "E-p:32:32"
22 target triple = "powerpc-apple-darwin8.7.0"
33
None ; RUN: opt < %s -gvn -disable-output
0 ; RUN: opt < %s -basicaa -gvn -disable-output
11 ; PR1774
22
33 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"
None ; RUN: opt < %s -gvn -disable-output
0 ; RUN: opt < %s -basicaa -gvn -disable-output
11 ; PR1782
22
33 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"
None ; RUN: opt < %s -gvn -disable-output
0 ; RUN: opt < %s -basicaa -gvn -disable-output
11 ; PR2395
22
33 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:32:32"
None ; RUN: opt < %s -aa-eval |& grep {1 no alias response}
0 ; RUN: opt < %s -basicaa -aa-eval |& grep {1 no alias response}
11
22 declare noalias i32* @_Znwj(i32 %x) nounwind
33
None ; RUN: opt -gvn -instcombine -S < %s | FileCheck %s
0 ; RUN: opt -basicaa -gvn -instcombine -S < %s | FileCheck %s
11 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
22
33 declare i8 @llvm.atomic.load.add.i8.p0i8(i8*, i8)
None ; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output |& grep {NoAlias:.*%P,.*@Z}
0 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& grep {NoAlias:.*%P,.*@Z}
11 ; If GEP base doesn't alias Z, then GEP doesn't alias Z.
22 ; rdar://7282591
33
None ; RUN: opt -aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s
0 ; RUN: opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output < %s |& FileCheck %s
11
22 declare void @callee(double* %callee_arg)
33 declare void @nocap_callee(double* nocapture %nocap_callee_arg)
None ; RUN: opt < %s -gvn -S | grep {ret i32 1}
0 ; RUN: opt < %s -basicaa -gvn -S | grep {ret i32 1}
11 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"
22 target triple = "i686-apple-darwin8"
33 %struct.x = type { i32, i32, i32, i32 }
None ; RUN: opt < %s -aa-eval -print-all-alias-modref-info |& FileCheck %s
0 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info |& FileCheck %s
11 ; PR4267
22
33 ; CHECK: MayAlias: double* %p.0.i.0, double* %p3
None ; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output \
0 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \
11 ; RUN: |& grep {NoAlias: \{\}\\* \[%\]p, \{\}\\* \[%\]q}
22
33 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"
None ; RUN: opt < %s -gvn -instcombine -S |& FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -instcombine -S |& FileCheck %s
11
22 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"
33
None ; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output |& FileCheck %s
0 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output |& FileCheck %s
11
22
33 ; CHECK: Just Ref: call void @ro() <-> call void @f0()
None ; RUN: opt < %s -aa-eval -print-all-alias-modref-info -disable-output \
0 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \
11 ; RUN: |& grep {NoAlias: double\\* \[%\]a, double\\* \[%\]b\$} | count 4
22
33 ; BasicAA should detect NoAliases in PHIs and Selects.
None ; RUN: opt -aa-eval -disable-output < %s >& /dev/null
0 ; RUN: opt -basicaa -aa-eval -disable-output < %s >& /dev/null
11
22 ; BasicAA shouldn't infinitely recurse on the use-def cycles in
33 ; unreachable code.
None ; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
0 ; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
11 @X = internal global i32 4 ; [#uses=1]
22
33 define i32 @test(i32* %P) {
None ; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
0 ; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
11
22 ; This test requires the use of previous analyses to determine that
33 ; doesnotmodX does not modify X (because 'sin' doesn't).
None ; RUN: opt < %s -globalsmodref-aa -gvn -instcombine -S | \
0 ; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -instcombine -S | \
11 ; RUN: grep {ret i32 0}
22
33 @G = internal global i32* null ; [#uses=3]
None ; RUN: opt < %s -globalsmodref-aa -gvn -S | not grep load
0 ; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | not grep load
11 @X = internal global i32 4 ; [#uses=2]
22
33 define i32 @test(i32* %P) {
None ; RUN: opt < %s -analyze -lda | FileCheck %s
0 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
11
22 ;; x[5] = x[6] // with x being a pointer passed as argument
33
None ; RUN: opt < %s -analyze -lda | FileCheck %s
0 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
11
22 @x = common global [256 x i32] zeroinitializer, align 4
33 @y = common global [256 x i32] zeroinitializer, align 4
None ; RUN: opt < %s -analyze -lda | FileCheck %s
0 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
11
22 @x = common global [256 x i32] zeroinitializer, align 4
33 @y = common global [256 x i32] zeroinitializer, align 4
None ; RUN: opt < %s -analyze -lda | FileCheck %s
0 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
11
22 @x = common global [256 x i32] zeroinitializer, align 4
33 @y = common global [256 x i32] zeroinitializer, align 4
None ; RUN: opt < %s -analyze -lda | FileCheck %s
0 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
11
22 @x = common global [256 x i32] zeroinitializer, align 4
33
None ; RUN: opt < %s -tbaa -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -tbaa -gvn -S | FileCheck %s
11
22 ; CHECK: @test0_yes
33 ; CHECK: add i8 %x, %x
None ; RUN: opt -lint -disable-output < %s |& FileCheck %s
0 ; RUN: opt -basicaa -lint -disable-output < %s |& FileCheck %s
11 target datalayout = "e-p:64:64:64"
22
33 declare fastcc void @bar()
None ; RUN: opt < %s -argpromotion -mem2reg -S | not grep alloca
0 ; RUN: opt < %s -basicaa -argpromotion -mem2reg -S | not grep alloca
11 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
22 define internal i32 @test(i32* %X, i32* %Y) {
33 %A = load i32* %X ; [#uses=1]
None ; RUN: opt < %s -dse -S | not grep tmp5
0 ; RUN: opt < %s -basicaa -dse -S | not grep tmp5
11 ; PR2599
22 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
33
None ; RUN: opt < %s -dse -S | \
0 ; RUN: opt < %s -basicaa -dse -S | \
11 ; RUN: not grep {store i8}
22 ; Ensure that the dead store is deleted in this case. It is wholely
33 ; overwritten by the second store.
None ; RUN: opt %s -dse -S | FileCheck %s
0 ; RUN: opt %s -basicaa -dse -S | FileCheck %s
11
22 %t = type { i32 }
33
None ; RUN: opt < %s -dse -S | not grep DEAD
0 ; RUN: opt < %s -basicaa -dse -S | not grep DEAD
11 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
22
33 declare void @ext()
None ; RUN: opt < %s -dse -S | not grep DEAD
0 ; RUN: opt < %s -basicaa -dse -S | not grep DEAD
11
22 define void @test(i32* %Q, i32* %P) {
33 %DEAD = load i32* %Q ; [#uses=1]
None ; RUN: opt -S -dse < %s | FileCheck %s
0 ; RUN: opt -S -basicaa -dse < %s | FileCheck %s
11
22 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
33
None ; RUN: opt %s -dse -S | FileCheck %s
0 ; RUN: opt %s -basicaa -dse -S | FileCheck %s
11
22 declare void @test1f()
33
None ; RUN: opt < %s -dse -S | not grep DEAD
0 ; RUN: opt < %s -basicaa -dse -S | not grep DEAD
11 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
22
33 define void @test(i32* %Q, i32* %P) {
None ; RUN: opt < %s -gvn -S | not grep {tmp10 =}
0 ; RUN: opt < %s -basicaa -gvn -S | not grep {tmp10 =}
11
22 %struct.INT2 = type { i32, i32 }
33 @blkshifts = external global %struct.INT2* ; <%struct.INT2**> [#uses=2]
None ; RUN: opt < %s -gvn -S | grep {tmp17625.* = phi i32. }
1 ; RUN: opt < %s -gvn -S | grep {tmp17631.* = phi i32. }
0 ; RUN: opt < %s -basicaa -gvn -S | grep {tmp17625.* = phi i32. }
1 ; RUN: opt < %s -basicaa -gvn -S | grep {tmp17631.* = phi i32. }
22
33 @last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=1]
44
None ; RUN: opt < %s -gvn -S | grep {tmp47 = phi i32 }
0 ; RUN: opt < %s -basicaa -gvn -S | grep {tmp47 = phi i32 }
11
22 %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
33 @debug = external constant i32 ; [#uses=0]
None ; RUN: opt < %s -gvn -S | not grep {tmp701 =}
0 ; RUN: opt < %s -basicaa -gvn -S | not grep {tmp701 =}
11
22 @img_width = external global i16 ; [#uses=2]
33
None ; RUN: opt < %s -gvn -S | grep {ret i8 \[%\]tmp3}
0 ; RUN: opt < %s -basicaa -gvn -S | grep {ret i8 \[%\]tmp3}
11 ; PR2503
22
33 @g_3 = external global i8 ; [#uses=2]
None ; RUN: opt < %s -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
11
22 define i8* @cat(i8* %s1, ...) nounwind {
33 entry:
None ; RUN: opt < %s -gvn -S | grep strlen | count 2
0 ; RUN: opt < %s -basicaa -gvn -S | grep strlen | count 2
11 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"
22 target triple = "i386-apple-darwin9"
33
None ; RUN: opt < %s -gvn -S | grep {br i1 false}
0 ; RUN: opt < %s -basicaa -gvn -S | grep {br i1 false}
11
22 @a = external global i32 ; [#uses=7]
33
None ; RUN: opt < %s -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
11
22 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"
33 target triple = "i386-apple-darwin7"
None ; RUN: opt < %s -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
11
22 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"
33 target triple = "i386-apple-darwin7"
None ; RUN: opt < %s -gvn -instcombine -S | grep {ret i32 0}
0 ; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0}
11 ; PR4189
22 @G = external constant [4 x i32]
33
None ; RUN: opt -S -gvn < %s | FileCheck %s
0 ; RUN: opt -S -basicaa -gvn < %s | FileCheck %s
11 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"
22 target triple = "i386-apple-darwin11.0.0"
33
None ; RUN: opt -S -gvn -enable-load-pre %s | FileCheck %s
0 ; RUN: opt -S -basicaa -gvn -enable-load-pre %s | FileCheck %s
11 ;
22 ; The partially redundant load in bb1 should be hoisted to "bb". This comes
33 ; from this C code (GCC PR 23455):
None ; RUN: opt < %s -gvn -S | not grep DEADLOAD
1 ; RUN: opt < %s -gvn -S | not grep DEADGEP
0 ; RUN: opt < %s -basicaa -gvn -S | not grep DEADLOAD
1 ; RUN: opt < %s -basicaa -gvn -S | not grep DEADGEP
22
33 define i32 @main(i32** %p) {
44 block1:
None ; RUN: opt < %s -gvn -stats -disable-output |& grep {Number of loads deleted}
0 ; RUN: opt < %s -basicaa -gvn -stats -disable-output |& grep {Number of loads deleted}
11 ; rdar://7363102
22
33 ; GVN should be able to eliminate load %tmp22.i, because it is redundant with
None ; RUN: opt %s -gvn -S | FileCheck %s
0 ; RUN: opt %s -basicaa -gvn -S | FileCheck %s
11
22 %t = type { i32 }
33 declare void @test1f(i8*)
None ; RUN: opt < %s -gvn -enable-load-pre -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -enable-load-pre -S | FileCheck %s
11 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"
22
33 define i32 @test1(i32* %p, i1 %C) {
None ; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 }
0 ; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 }
11
22 ; GVN should eliminate the fully redundant %9 GEP which
33 ; allows DEAD to be removed. This is PR3198.
None ; RUN: opt < %s -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
11
22 define i32 @main(i32** %p) {
33 block1:
None ; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 }
0 ; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 }
11
22 define i32 @main(i32* %p) {
33 block1:
None ; RUN: opt < %s -gvn -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
11
22 ; 32-bit little endian target.
33 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"
None ; RUN: opt -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s
0 ; RUN: opt -basicaa -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s
11 ; PR5009
22
33 ; CHECK: define i32 @main()
None ; RUN: opt -S -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s
0 ; RUN: opt -S -basicaa -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s
11 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"
22 target triple = "x86_64-apple-darwin10.0.0"
33
None ; RUN: opt -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s
0 ; RUN: opt -basicaa -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s
11 ; rdar://6295824 and PR6724
22
33 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"
None ; RUN: opt < %s -licm -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
11
22 @a = external constant float*
33
None ; RUN: opt < %s -licm -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
11 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
22
33 @X = global i32 7 ; [#uses=4]
None ; RUN: opt < %s -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp
0 ; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp
11 ; PR2077
22
33 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:32:32"
None ; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy.}
0 ; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy.}
11 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
22 %a = type { i32 }
33 %b = type { float }
None ; RUN: opt -S < %s -memcpyopt | FileCheck %s
0 ; RUN: opt -S < %s -basicaa -memcpyopt | FileCheck %s
11 ;
22
33 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"
None ; RUN: opt < %s -memcpyopt -dse -S | grep {call.*memcpy} | count 1
0 ; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*memcpy} | count 1
11
22 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"
33 target triple = "i686-apple-darwin9"
None ; RUN: opt < %s -memcpyopt -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -memcpyopt -S | FileCheck %s
11 ; These memmoves should get optimized to memcpys.
22
33 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"
None ; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy}
0 ; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy}
11
22 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"
33 target triple = "i686-apple-darwin9"
None ; RUN: opt < %s -sink -S | FileCheck %s
0 ; RUN: opt < %s -basicaa -sink -S | FileCheck %s
11
22 @A = external global i32
33 @B = external global i32