[llvm-dev] assertion in MachineCopyPropagation::isNopCopy

Verena Beckham via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 30 06:47:50 PDT 2017


Hi,

I'm hitting an assertion in MachineCopyPropagation::isNopCopy:

if (Src == PreviousSrc) {
   assert(Def == PreviousDef);
   return true;
}

This code compares two COPY instruction to see whether they are 
effectively "the same". The assert assumes that, if the sources are the 
same register then the destinations must be as well.
My instructions look like this, however:

   %V2<def> = COPY %V6
   %V6<def> = COPY %V2_LO

(isNopCopy is called with src and dest of the first instruction switched.)
So dst2 == src1 but src2 is a subregister of dst1.
Is there some assumption that size(src) == size(dst)?
This second COPY, with size(src) != size(dst) was generated in 
InstrEmitter::EmitSubregNode at

// Create the extract_subreg machine instruction.

So it's not out-of-tree code.
Am I missing something or should the assert condition be part of the 
"if" condition instead?
Thanks,

-- 
Verena Beckham

Senior Principal Software Engineer, Compilers

Codeplay Software Ltd
Level C, Argyle House, 3 Lady Lawson Street, Edinburgh, EH3 9DR
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com

This email and any attachments may contain confidential and /or 
privileged information and  is for use  by the addressee only. If you 
are not the intended recipient, please notify Codeplay Software Ltd 
immediately and delete the message from your computer. You may not copy 
or forward it,or use or disclose its contents to any other person. Any 
views or other information in this message which do not relate to our 
business are not authorized by Codeplay software Ltd, nor does this 
message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay 
Software Ltd does not accept any responsibility for any changes made to 
this message after it was sent. Please note that Codeplay Software Ltd 
does not accept any liability or responsibility for viruses and it is 
your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: Regent house, 316 Beulah Hill, London, United 
Kingdom, SE19 3HF


More information about the llvm-dev mailing list