[PATCH] D59227: [GlobalISel][Utils] Teach getConstantVRegVal how to look through trunc and z|sext

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 11:08:40 PDT 2019


arsenm added a comment.

In D59227#1427702 <https://reviews.llvm.org/D59227#1427702>, @qcolombet wrote:

>




> I agree that the G_CONSTANT are a mov to a legal result register. However, I don't think they should be legalized on there own. Essentially, if we truncate/extend the constants directly during the legalization of their uses, they naturally become legal (the illegal ones become dead). I.e., we don't have to handle G_CONSTANT explicitly. This is true only if the builders don't create thing like ext(cst), like they do today, because then we indeed have to legalize those immediate moves.

I'm not sure why we would want special rules for constant handling. I think it would be cleaner to just keep them treated as any other normal instruction. I'm assuming you mean the legalizer by builder. If you're going to try to avoid the intermediate legalization artifacts by looking at the uses, I don't see why you wouldn't change the legalizer worklist to do this for every instruction.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59227/new/

https://reviews.llvm.org/D59227





More information about the llvm-commits mailing list