diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-01 12:42:23 -0700 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-01 12:50:18 -0700 |
commit | e65e677ee4eed83a31503b1a7db3fca56f617eae (patch) | |
tree | 47042ed387014a117ba385ce9b926bbe0799d624 | |
parent | 8e5a8f620cc2ac2805fce77eddea3405329f90df (diff) | |
download | llvm-e65e677ee4eed83a31503b1a7db3fca56f617eae.zip llvm-e65e677ee4eed83a31503b1a7db3fca56f617eae.tar.gz llvm-e65e677ee4eed83a31503b1a7db3fca56f617eae.tar.bz2 |
[globalisel][legalizer] Fix DebugLoc bugs caught by a prototype lost-location verifier
The legalizer has a tendency to lose DebugLoc's when expanding or
combining instructions. The verifier that detected these isn't ready
for upstreaming yet but this patch fixes the cases that came up when
applying it to our out-of-tree backend's CodeGen tests.
This pattern comes up a few more times in this file and probably in
the backends too but I'd prefer to fix the others separately (and
preferably when the lost-location verifier detects them).
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index 454a63e..bb14448 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -634,6 +634,7 @@ LegalizerHelper::libcall(MachineInstr &MI) { auto &Ctx = MIRBuilder.getMF().getFunction().getContext(); MIRBuilder.setInstr(MI); + MIRBuilder.setDebugLoc(MI.getDebugLoc()); switch (MI.getOpcode()) { default: @@ -731,6 +732,7 @@ LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalar(MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy) { MIRBuilder.setInstr(MI); + MIRBuilder.setDebugLoc(MI.getDebugLoc()); uint64_t SizeOp0 = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits(); uint64_t NarrowSize = NarrowTy.getSizeInBits(); @@ -1596,6 +1598,7 @@ LegalizerHelper::widenScalarInsert(MachineInstr &MI, unsigned TypeIdx, LegalizerHelper::LegalizeResult LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) { MIRBuilder.setInstr(MI); + MIRBuilder.setDebugLoc(MI.getDebugLoc()); switch (MI.getOpcode()) { default: @@ -2188,6 +2191,7 @@ LegalizerHelper::LegalizeResult LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty) { using namespace TargetOpcode; MIRBuilder.setInstr(MI); + MIRBuilder.setDebugLoc(MI.getDebugLoc()); switch(MI.getOpcode()) { default: @@ -3223,6 +3227,7 @@ LegalizerHelper::fewerElementsVector(MachineInstr &MI, unsigned TypeIdx, using namespace TargetOpcode; MIRBuilder.setInstr(MI); + MIRBuilder.setDebugLoc(MI.getDebugLoc()); switch (MI.getOpcode()) { case G_IMPLICIT_DEF: return fewerElementsVectorImplicitDef(MI, TypeIdx, NarrowTy); |