[llvm] r244020 - [MachineCombiner] Don't use the opcode-only form of computeInstrLatency
Hal Finkel
hfinkel at anl.gov
Wed Aug 5 00:45:28 PDT 2015
Author: hfinkel
Date: Wed Aug 5 02:45:28 2015
New Revision: 244020
URL: http://llvm.org/viewvc/llvm-project?rev=244020&view=rev
Log:
[MachineCombiner] Don't use the opcode-only form of computeInstrLatency
In r242277, I updated the MachineCombiner to work with itineraries, but I
missed a call that is scheduling-model-only (the opcode-only form of
computeInstrLatency). Using the form that takes an MI* allows this to work with
itineraries (and should be NFC for subtargets with scheduling models).
Added:
llvm/trunk/test/CodeGen/PowerPC/mc-instrlat.ll
Modified:
llvm/trunk/lib/CodeGen/MachineCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/MachineCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCombiner.cpp?rev=244020&r1=244019&r2=244020&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCombiner.cpp Wed Aug 5 02:45:28 2015
@@ -204,7 +204,7 @@ unsigned MachineCombiner::getLatency(Mac
NewRoot, NewRoot->findRegisterDefOperandIdx(MO.getReg()), UseMO,
UseMO->findRegisterUseOperandIdx(MO.getReg()));
} else {
- LatencyOp = TSchedModel.computeInstrLatency(NewRoot->getOpcode());
+ LatencyOp = TSchedModel.computeInstrLatency(NewRoot);
}
NewRootLatency = std::max(NewRootLatency, LatencyOp);
}
Added: llvm/trunk/test/CodeGen/PowerPC/mc-instrlat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/mc-instrlat.ll?rev=244020&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/mc-instrlat.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/mc-instrlat.ll Wed Aug 5 02:45:28 2015
@@ -0,0 +1,25 @@
+; RUN: llc -O3 < %s | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+; Function Attrs: nounwind
+define void @foo(double %eps) #0 {
+entry:
+ %0 = fmul fast double %eps, %eps
+ %div = fmul fast double %0, 0x3FD5555555555555
+ tail call void @bar(double %div) #2
+ unreachable
+
+; This used to crash because we'd call a function to compute instruction
+; latency not supported with itineraries.
+; CHECK-LABEL: @foo
+; CHECK: bar
+
+}
+
+declare void @bar(double) #1
+
+attributes #0 = { nounwind "no-infs-fp-math"="true" "no-nans-fp-math"="true" "target-cpu"="ppc64" "target-features"="+altivec,-bpermd,-crypto,-direct-move,-extdiv,-power8-vector,-qpx,-vsx" "unsafe-fp-math"="true" "use-soft-float"="false" }
+attributes #1 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="ppc64" "target-features"="+altivec,-bpermd,-crypto,-direct-move,-extdiv,-power8-vector,-qpx,-vsx" "unsafe-fp-math"="true" "use-soft-float"="false" }
+attributes #2 = { nounwind }
+
More information about the llvm-commits
mailing list