aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-27 21:08:51 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-27 21:08:51 +0000
commitaff3ef6f6ccad9bd4e082546f8161727c2019117 (patch)
tree830a00991f5796e53057448d5fa417ccc9c29b11
parentdadbdfff07596fc3b48cc1e735181b9b8c893f67 (diff)
downloadsrc-aff3ef6f6ccad9bd4e082546f8161727c2019117.tar.gz
src-aff3ef6f6ccad9bd4e082546f8161727c2019117.zip
Vendor import of llvm release_38 branch r258968:vendor/llvm/llvm-release_38-r258968
Notes
Notes: svn path=/vendor/llvm/dist/; revision=294938 svn path=/vendor/llvm/llvm-release_38-r258968/; revision=294939; tag=vendor/llvm/llvm-release_38-r258968
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h6
-rw-r--r--lib/Analysis/DemandedBits.cpp2
-rw-r--r--lib/Analysis/ScalarEvolution.cpp8
-rw-r--r--lib/Target/AMDGPU/AMDGPU.td5
-rw-r--r--lib/Target/AMDGPU/AMDGPUSubtarget.cpp2
-rw-r--r--lib/Target/AMDGPU/AMDGPUSubtarget.h5
-rw-r--r--lib/Target/AMDGPU/AMDGPUTargetMachine.cpp2
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp3
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp10
-rw-r--r--test/Analysis/DemandedBits/basic.ll13
-rw-r--r--test/CodeGen/X86/cmovcmov.ll49
-rw-r--r--test/Transforms/GCOVProfiling/modules.ll12
-rw-r--r--test/Transforms/IndVarSimplify/pr26207.ll20
-rwxr-xr-xutils/release/test-release.sh71
14 files changed, 157 insertions, 51 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index c08335de3e7d..ef9305788849 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -412,7 +412,11 @@ namespace llvm {
/*implicit*/ ExitLimit(const SCEV *E) : Exact(E), Max(E) {}
- ExitLimit(const SCEV *E, const SCEV *M) : Exact(E), Max(M) {}
+ ExitLimit(const SCEV *E, const SCEV *M) : Exact(E), Max(M) {
+ assert((isa<SCEVCouldNotCompute>(Exact) ||
+ !isa<SCEVCouldNotCompute>(Max)) &&
+ "Exact is not allowed to be less precise than Max");
+ }
/// Test whether this ExitLimit contains any computed information, or
/// whether it's all SCEVCouldNotCompute values.
diff --git a/lib/Analysis/DemandedBits.cpp b/lib/Analysis/DemandedBits.cpp
index 912c5ceb754d..143d0b79f188 100644
--- a/lib/Analysis/DemandedBits.cpp
+++ b/lib/Analysis/DemandedBits.cpp
@@ -244,7 +244,7 @@ void DemandedBits::determineLiveOperandBits(
break;
case Instruction::ICmp:
// Count the number of leading zeroes in each operand.
- ComputeKnownBits(BitWidth, I, UserI->getOperand(1));
+ ComputeKnownBits(BitWidth, UserI->getOperand(0), UserI->getOperand(1));
auto NumLeadingZeroes = std::min(KnownZero.countLeadingOnes(),
KnownZero2.countLeadingOnes());
AB = ~APInt::getHighBitsSet(BitWidth, NumLeadingZeroes);
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 34074efd1ceb..ef1bb3a36c8d 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -5368,6 +5368,14 @@ ScalarEvolution::computeExitLimitFromCond(const Loop *L,
BECount = EL0.Exact;
}
+ // There are cases (e.g. PR26207) where computeExitLimitFromCond is able
+ // to be more aggressive when computing BECount than when computing
+ // MaxBECount. In these cases it is possible for EL0.Exact and EL1.Exact
+ // to match, but for EL0.Max and EL1.Max to not.
+ if (isa<SCEVCouldNotCompute>(MaxBECount) &&
+ !isa<SCEVCouldNotCompute>(BECount))
+ MaxBECount = BECount;
+
return ExitLimit(BECount, MaxBECount);
}
if (BO->getOpcode() == Instruction::Or) {
diff --git a/lib/Target/AMDGPU/AMDGPU.td b/lib/Target/AMDGPU/AMDGPU.td
index db869cf7dd8b..79c6604c4cc8 100644
--- a/lib/Target/AMDGPU/AMDGPU.td
+++ b/lib/Target/AMDGPU/AMDGPU.td
@@ -138,6 +138,11 @@ def FeatureEnableHugeScratchBuffer : SubtargetFeature<"huge-scratch-buffer",
"true",
"Enable scratch buffer sizes greater than 128 GB">;
+def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
+ "EnableSIScheduler",
+ "true",
+ "Enable SI Machine Scheduler">;
+
class SubtargetFeatureFetchLimit <string Value> :
SubtargetFeature <"fetch"#Value,
"TexVTXClauseSize",
diff --git a/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
index c6af5b93d257..7d70fa73da29 100644
--- a/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ b/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -78,7 +78,7 @@ AMDGPUSubtarget::AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
EnableVGPRSpilling(false), SGPRInitBug(false), IsGCN(false),
GCN1Encoding(false), GCN3Encoding(false), CIInsts(false), LDSBankCount(0),
IsaVersion(ISAVersion0_0_0), EnableHugeScratchBuffer(false),
- FrameLowering(nullptr),
+ EnableSIScheduler(false), FrameLowering(nullptr),
InstrItins(getInstrItineraryForCPU(GPU)), TargetTriple(TT) {
initializeSubtargetDependencies(TT, GPU, FS);
diff --git a/lib/Target/AMDGPU/AMDGPUSubtarget.h b/lib/Target/AMDGPU/AMDGPUSubtarget.h
index d3712276d5e7..4796e9ef3454 100644
--- a/lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ b/lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -90,6 +90,7 @@ private:
int LDSBankCount;
unsigned IsaVersion;
bool EnableHugeScratchBuffer;
+ bool EnableSIScheduler;
std::unique_ptr<AMDGPUFrameLowering> FrameLowering;
std::unique_ptr<AMDGPUTargetLowering> TLInfo;
@@ -280,6 +281,10 @@ public:
return EnableHugeScratchBuffer;
}
+ bool enableSIScheduler() const {
+ return EnableSIScheduler;
+ }
+
bool dumpCode() const {
return DumpCode;
}
diff --git a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index b1be6197a6c6..519ae5cc748d 100644
--- a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -147,6 +147,8 @@ public:
const AMDGPUSubtarget &ST = *getAMDGPUTargetMachine().getSubtargetImpl();
if (ST.getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS)
return createR600MachineScheduler(C);
+ else if (ST.enableSIScheduler())
+ return createSIMachineScheduler(C);
return nullptr;
}
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 6904714ec781..34f39190ab96 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -21880,7 +21880,8 @@ X86TargetLowering::EmitLoweredSelect(MachineInstr *MI,
if (LastCMOV == MI &&
NextMIIt != BB->end() && NextMIIt->getOpcode() == MI->getOpcode() &&
NextMIIt->getOperand(2).getReg() == MI->getOperand(2).getReg() &&
- NextMIIt->getOperand(1).getReg() == MI->getOperand(0).getReg()) {
+ NextMIIt->getOperand(1).getReg() == MI->getOperand(0).getReg() &&
+ NextMIIt->getOperand(1).isKill()) {
CascadedCMOV = &*NextMIIt;
}
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index fa939aee252a..ffde7f8d9bae 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -494,6 +494,11 @@ void GCOVProfiler::emitProfileNotes() {
// LTO, we'll generate the same .gcno files.
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
+
+ // Skip module skeleton (and module) CUs.
+ if (CU->getDWOId())
+ continue;
+
std::error_code EC;
raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None);
std::string EdgeDestinations;
@@ -853,6 +858,11 @@ Function *GCOVProfiler::insertCounterWriteout(
if (CU_Nodes) {
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
+
+ // Skip module skeleton (and module) CUs.
+ if (CU->getDWOId())
+ continue;
+
std::string FilenameGcda = mangleName(CU, "gcda");
uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i];
Builder.CreateCall(StartFile,
diff --git a/test/Analysis/DemandedBits/basic.ll b/test/Analysis/DemandedBits/basic.ll
index 487e522e9dbc..9973edf79c17 100644
--- a/test/Analysis/DemandedBits/basic.ll
+++ b/test/Analysis/DemandedBits/basic.ll
@@ -24,11 +24,20 @@ define i1 @test_icmp1(i32 %a, i32 %b) {
; CHECK-LABEL: 'test_icmp2'
; CHECK-DAG: DemandedBits: 0x1 for %3 = icmp eq i32 %1, %2
-; CHECK-DAG: DemandedBits: 0xFF for %1 = and i32 %a, 255
-; CHECK-DAG: DemandedBits: 0xF for %2 = ashr i32 %1, 4
+; CHECK-DAG: DemandedBits: 0xFFF for %1 = and i32 %a, 255
+; CHECK-DAG: DemandedBits: 0xFF for %2 = ashr i32 %1, 4
define i1 @test_icmp2(i32 %a, i32 %b) {
%1 = and i32 %a, 255
%2 = ashr i32 %1, 4
%3 = icmp eq i32 %1, %2
ret i1 %3
}
+
+; CHECK-LABEL: 'test_icmp3'
+; CHECK-DAG: DemandedBits: 0xFFFFFFFF for %1 = and i32 %a, 255
+; CHECK-DAG: DemandedBits: 0x1 for %2 = icmp eq i32 -1, %1
+define i1 @test_icmp3(i32 %a) {
+ %1 = and i32 %a, 255
+ %2 = icmp eq i32 -1, %1
+ ret i1 %2
+}
diff --git a/test/CodeGen/X86/cmovcmov.ll b/test/CodeGen/X86/cmovcmov.ll
index d3d9748d6530..9363d31866d7 100644
--- a/test/CodeGen/X86/cmovcmov.ll
+++ b/test/CodeGen/X86/cmovcmov.ll
@@ -224,3 +224,52 @@ entry:
}
attributes #0 = { nounwind }
+
+@g8 = global i8 0
+
+; The following test failed because llvm had a bug where a structure like:
+;
+; %vreg12<def> = CMOV_GR8 %vreg7, %vreg11 ... (lt)
+; %vreg13<def> = CMOV_GR8 %vreg12, %vreg11 ... (gt)
+;
+; was lowered to:
+;
+; The first two cmovs got expanded to:
+; BB#0:
+; JL_1 BB#9
+; BB#7:
+; JG_1 BB#9
+; BB#8:
+; BB#9:
+; vreg12 = phi(vreg7, BB#8, vreg11, BB#0, vreg12, BB#7)
+; vreg13 = COPY vreg12
+; Which was invalid as %vreg12 is not the same value as %vreg13
+
+; CHECK-LABEL: no_cascade_opt:
+; CMOV-DAG: cmpl %edx, %esi
+; CMOV-DAG: movb $20, %al
+; CMOV-DAG: movb $20, %dl
+; CMOV: jl [[BB0:.LBB[0-9_]+]]
+; CMOV: movb %cl, %dl
+; CMOV: [[BB0]]:
+; CMOV: jg [[BB1:.LBB[0-9_]+]]
+; CMOV: movb %dl, %al
+; CMOV: [[BB1]]:
+; CMOV: testl %edi, %edi
+; CMOV: je [[BB2:.LBB[0-9_]+]]
+; CMOV: movb %dl, %al
+; CMOV: [[BB2]]:
+; CMOV: movb %al, g8(%rip)
+; CMOV: retq
+define void @no_cascade_opt(i32 %v0, i32 %v1, i32 %v2, i32 %v3) {
+entry:
+ %c0 = icmp eq i32 %v0, 0
+ %c1 = icmp slt i32 %v1, %v2
+ %c2 = icmp sgt i32 %v1, %v2
+ %trunc = trunc i32 %v3 to i8
+ %sel0 = select i1 %c1, i8 20, i8 %trunc
+ %sel1 = select i1 %c2, i8 20, i8 %sel0
+ %sel2 = select i1 %c0, i8 %sel1, i8 %sel0
+ store volatile i8 %sel2, i8* @g8
+ ret void
+}
diff --git a/test/Transforms/GCOVProfiling/modules.ll b/test/Transforms/GCOVProfiling/modules.ll
new file mode 100644
index 000000000000..1a8edfeedd4c
--- /dev/null
+++ b/test/Transforms/GCOVProfiling/modules.ll
@@ -0,0 +1,12 @@
+; RUN: opt -insert-gcov-profiling -o - < %s | llvm-dis | FileCheck -check-prefix=EMIT-ARCS %s
+
+; EMIT-ARCS-NOT: call void @llvm_gcda_start_file
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: false, runtimeVersion: 2, splitDebugFilename: "my.dwo", emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2, imports: !2, dwoId: 43981)
+!1 = !DIFile(filename: "<stdin>", directory: "/")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
diff --git a/test/Transforms/IndVarSimplify/pr26207.ll b/test/Transforms/IndVarSimplify/pr26207.ll
new file mode 100644
index 000000000000..9d351e098572
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/pr26207.ll
@@ -0,0 +1,20 @@
+; RUN: opt -S -indvars < %s | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @main(i16 %in) {
+; CHECK-LABEL: @main(
+ br label %bb2
+
+bb2: ; preds = %bb1.i, %bb2, %0
+ %_tmp44.i = icmp slt i16 %in, 2
+ br i1 %_tmp44.i, label %bb1.i, label %bb2
+
+bb1.i: ; preds = %bb1.i, %bb2
+ %_tmp25.i = phi i16 [ %in, %bb2 ], [ %_tmp6.i, %bb1.i ]
+ %_tmp6.i = add nsw i16 %_tmp25.i, 1
+ %_tmp10.i = icmp sge i16 %_tmp6.i, 2
+ %exitcond.i = icmp eq i16 %_tmp6.i, 2
+ %or.cond = and i1 %_tmp10.i, %exitcond.i
+ br i1 %or.cond, label %bb2, label %bb1.i
+}
diff --git a/utils/release/test-release.sh b/utils/release/test-release.sh
index c3884ba31756..c5fe631da998 100755
--- a/utils/release/test-release.sh
+++ b/utils/release/test-release.sh
@@ -267,56 +267,36 @@ function export_sources() {
check_valid_urls
for proj in $projects ; do
- if [ -d $proj.src ]; then
- echo "# Reusing $proj $Release-$RC sources"
+ case $proj in
+ llvm)
+ projsrc=$proj.src
+ ;;
+ cfe)
+ projsrc=llvm.src/tools/clang
+ ;;
+ clang-tools-extra)
+ projsrc=llvm.src/tools/clang/tools/extra
+ ;;
+ compiler-rt|libcxx|libcxxabi|libunwind|openmp|test-suite)
+ projsrc=llvm.src/projects/$proj
+ ;;
+ *)
+ echo "error: unknown project $proj"
+ exit 1
+ ;;
+ esac
+
+ if [ -d $projsrc ]; then
+ echo "# Reusing $proj $Release-$RC sources in $projsrc"
continue
fi
- echo "# Exporting $proj $Release-$RC sources"
- if ! svn export -q $Base_url/$proj/$ExportBranch $proj.src ; then
+ echo "# Exporting $proj $Release-$RC sources to $projsrc"
+ if ! svn export -q $Base_url/$proj/$ExportBranch $projsrc ; then
echo "error: failed to export $proj project"
exit 1
fi
done
- echo "# Creating symlinks"
- cd $BuildDir/llvm.src/tools
- if [ ! -h clang ]; then
- ln -s ../../cfe.src clang
- fi
-
- # The autoconf and CMake builds want different symlinks here:
- if [ "$use_autoconf" = "yes" ]; then
- cd $BuildDir/llvm.src/tools/clang/tools
- if [ ! -h extra ]; then
- ln -s ../../../../clang-tools-extra.src extra
- fi
- else
- cd $BuildDir/cfe.src/tools
- if [ ! -h extra ]; then
- ln -s ../../clang-tools-extra.src extra
- fi
- fi
-
- cd $BuildDir/llvm.src/projects
- if [ -d $BuildDir/test-suite.src ] && [ ! -h test-suite ]; then
- ln -s ../../test-suite.src test-suite
- fi
- if [ -d $BuildDir/compiler-rt.src ] && [ ! -h compiler-rt ]; then
- ln -s ../../compiler-rt.src compiler-rt
- fi
- if [ -d $BuildDir/openmp.src ] && [ ! -h openmp ]; then
- ln -s ../../openmp.src openmp
- fi
- if [ -d $BuildDir/libcxx.src ] && [ ! -h libcxx ]; then
- ln -s ../../libcxx.src libcxx
- fi
- if [ -d $BuildDir/libcxxabi.src ] && [ ! -h libcxxabi ]; then
- ln -s ../../libcxxabi.src libcxxabi
- fi
- if [ -d $BuildDir/libunwind.src ] && [ ! -h libunwind ]; then
- ln -s ../../libunwind.src libunwind
- fi
-
cd $BuildDir
}
@@ -560,8 +540,9 @@ for Flavor in $Flavors ; do
# Substitute 'Phase2' for 'Phase3' in the Phase 2 object file in
# case there are build paths in the debug info. On some systems,
# sed adds a newline to the output, so pass $p3 through sed too.
- if ! cmp -s <(sed -e 's,Phase2,Phase3,g' $p2) <(sed -e '' $p3) \
- 16 16 ; then
+ if ! cmp -s \
+ <(env LC_CTYPE=C sed -e 's,Phase2,Phase3,g' $p2) \
+ <(env LC_CTYPE=C sed -e '' $p3) 16 16; then
echo "file `basename $p2` differs between phase 2 and phase 3"
fi
done