diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2015-08-05 07:45:28 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2015-08-05 07:45:28 +0000 |
| commit | 17caf326e5dbf5f4aa320948f8a195d7465eeab0 (patch) | |
| tree | cd71dc4b7f1575feb11566228a94ab376d6cdfb6 | |
| parent | ccd53feee28e1da37a40a25f1638fd0af595f0dc (diff) | |
| download | bcm5719-llvm-17caf326e5dbf5f4aa320948f8a195d7465eeab0.tar.gz bcm5719-llvm-17caf326e5dbf5f4aa320948f8a195d7465eeab0.zip | |
[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).
llvm-svn: 244020
| -rw-r--r-- | llvm/lib/CodeGen/MachineCombiner.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/mc-instrlat.ll | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp index b5b5ac027eb..aab436f4a5a 100644 --- a/llvm/lib/CodeGen/MachineCombiner.cpp +++ b/llvm/lib/CodeGen/MachineCombiner.cpp @@ -204,7 +204,7 @@ unsigned MachineCombiner::getLatency(MachineInstr *Root, MachineInstr *NewRoot, 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); } diff --git a/llvm/test/CodeGen/PowerPC/mc-instrlat.ll b/llvm/test/CodeGen/PowerPC/mc-instrlat.ll new file mode 100644 index 00000000000..0bbac14f6d3 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/mc-instrlat.ll @@ -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 } + |

