Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: lib/Transforms/Scalar/LoopStrengthReduce.cpp

Issue 7792066: [llvm] Conditionally include target intrinsics, based on --enable-target Base URL: https://llvm.org/svn/llvm-project/llvm/trunk/
Patch Set: cleanups Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- LoopStrengthReduce.cpp - Strength Reduce IVs in Loops --------------===// 1 //===- LoopStrengthReduce.cpp - Strength Reduce IVs in Loops --------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This transformation analyzes and transforms the induction variables (and 10 // This transformation analyzes and transforms the induction variables (and
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 bool isAddress = isa<LoadInst>(Inst); 574 bool isAddress = isa<LoadInst>(Inst);
575 if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { 575 if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
576 if (SI->getOperand(1) == OperandVal) 576 if (SI->getOperand(1) == OperandVal)
577 isAddress = true; 577 isAddress = true;
578 } else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) { 578 } else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
579 // Addressing modes can also be folded into prefetches and a variety 579 // Addressing modes can also be folded into prefetches and a variety
580 // of intrinsics. 580 // of intrinsics.
581 switch (II->getIntrinsicID()) { 581 switch (II->getIntrinsicID()) {
582 default: break; 582 default: break;
583 case Intrinsic::prefetch: 583 case Intrinsic::prefetch:
584 #if defined(TARGET_ENABLED_X86)
584 case Intrinsic::x86_sse_storeu_ps: 585 case Intrinsic::x86_sse_storeu_ps:
585 case Intrinsic::x86_sse2_storeu_pd: 586 case Intrinsic::x86_sse2_storeu_pd:
586 case Intrinsic::x86_sse2_storeu_dq: 587 case Intrinsic::x86_sse2_storeu_dq:
587 case Intrinsic::x86_sse2_storel_dq: 588 case Intrinsic::x86_sse2_storel_dq:
589 #endif // TARGET_ENABLED_X86
588 if (II->getArgOperand(0) == OperandVal) 590 if (II->getArgOperand(0) == OperandVal)
589 isAddress = true; 591 isAddress = true;
590 break; 592 break;
591 } 593 }
592 } 594 }
593 return isAddress; 595 return isAddress;
594 } 596 }
595 597
596 /// getAccessType - Return the type of the memory being accessed. 598 /// getAccessType - Return the type of the memory being accessed.
597 static Type *getAccessType(const Instruction *Inst) { 599 static Type *getAccessType(const Instruction *Inst) {
598 Type *AccessTy = Inst->getType(); 600 Type *AccessTy = Inst->getType();
599 if (const StoreInst *SI = dyn_cast<StoreInst>(Inst)) 601 if (const StoreInst *SI = dyn_cast<StoreInst>(Inst))
600 AccessTy = SI->getOperand(0)->getType(); 602 AccessTy = SI->getOperand(0)->getType();
601 else if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) { 603 else if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
602 // Addressing modes can also be folded into prefetches and a variety 604 // Addressing modes can also be folded into prefetches and a variety
603 // of intrinsics. 605 // of intrinsics.
604 switch (II->getIntrinsicID()) { 606 switch (II->getIntrinsicID()) {
605 default: break; 607 default: break;
608 #if defined(TARGET_ENABLED_X86)
606 case Intrinsic::x86_sse_storeu_ps: 609 case Intrinsic::x86_sse_storeu_ps:
607 case Intrinsic::x86_sse2_storeu_pd: 610 case Intrinsic::x86_sse2_storeu_pd:
608 case Intrinsic::x86_sse2_storeu_dq: 611 case Intrinsic::x86_sse2_storeu_dq:
609 case Intrinsic::x86_sse2_storel_dq: 612 case Intrinsic::x86_sse2_storel_dq:
610 AccessTy = II->getArgOperand(0)->getType(); 613 AccessTy = II->getArgOperand(0)->getType();
611 break; 614 break;
615 #endif // TARGET_ENABLED_X86
612 } 616 }
613 } 617 }
614 618
615 // All pointers have the same requirements, so canonicalize them to an 619 // All pointers have the same requirements, so canonicalize them to an
616 // arbitrary pointer type to minimize variation. 620 // arbitrary pointer type to minimize variation.
617 if (PointerType *PTy = dyn_cast<PointerType>(AccessTy)) 621 if (PointerType *PTy = dyn_cast<PointerType>(AccessTy))
618 AccessTy = PointerType::get(IntegerType::get(PTy->getContext(), 1), 622 AccessTy = PointerType::get(IntegerType::get(PTy->getContext(), 1),
619 PTy->getAddressSpace()); 623 PTy->getAddressSpace());
620 624
621 return AccessTy; 625 return AccessTy;
(...skipping 3301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3923 3927
3924 // Run the main LSR transformation. 3928 // Run the main LSR transformation.
3925 Changed |= LSRInstance(TLI, L, this).getChanged(); 3929 Changed |= LSRInstance(TLI, L, this).getChanged();
3926 3930
3927 // At this point, it is worth checking to see if any recurrence PHIs are also 3931 // At this point, it is worth checking to see if any recurrence PHIs are also
3928 // dead, so that we can remove them as well. 3932 // dead, so that we can remove them as well.
3929 Changed |= DeleteDeadPHIs(L->getHeader()); 3933 Changed |= DeleteDeadPHIs(L->getHeader());
3930 3934
3931 return Changed; 3935 return Changed;
3932 } 3936 }
OLDNEW
« no previous file with comments | « lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp ('k') | test/Analysis/BasicAA/ARM/dg.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698