[PATCH] [VER 2] replace llvm_unreachable call with emitError in SIInstrInfo::copyPhysReg

Tom Stellard tom at stellard.net
Tue Apr 15 10:36:42 PDT 2014


On Fri, Apr 11, 2014 at 03:16:10PM -0700, David Blaikie wrote:
> On Fri, Apr 11, 2014 at 2:09 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> > From: Darren <darren.powell at amd.com>
> >
> > ---
> >  lib/Target/R600/SIInstrInfo.cpp | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/Target/R600/SIInstrInfo.cpp b/lib/Target/R600/SIInstrInfo.cpp
> > index b19ff98..6d22c1b 100644
> > --- a/lib/Target/R600/SIInstrInfo.cpp
> > +++ b/lib/Target/R600/SIInstrInfo.cpp
> > @@ -19,6 +19,8 @@
> >  #include "SIMachineFunctionInfo.h"
> >  #include "llvm/CodeGen/MachineInstrBuilder.h"
> >  #include "llvm/CodeGen/MachineRegisterInfo.h"
> > +#include "llvm/IR/Function.h"
> > +#include "llvm/IR/LLVMContext.h"
> >  #include "llvm/MC/MCInstrDesc.h"
> >
> >  using namespace llvm;
> > @@ -153,7 +155,10 @@ SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
> >      SubIndices = Sub0_15;
> >
> >    } else {
> > -    llvm_unreachable("Can't copy register!");
> > +    const MachineFunction *MF = MBB.getParent();
> > +    LLVMContext &Ctx = MF->getFunction()->getContext();
> > +
> > +    Ctx.emitError(Twine("SIInstrInfo::copyPhysReg - Can't copy register!"));
> 
> I wouldn't've thought the explicit "Twine(...)" would be necessary
> here. Unless there's an extra user defined conversion here, that would
> be surprising.
> 

The explicit Twine() isn't necessary.  Here is an updated patch.

-Tom

> >    }
> >
> >    while (unsigned SubIdx = *SubIndices++) {
> > --
> > 1.8.3.2
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-VER-3-replace-llvm_unreachable-call-with-emitError-i.patch
Type: text/x-diff
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140415/8bd7214a/attachment.patch>


More information about the llvm-commits mailing list