[PATCH] D31503: [GlobalISel]: Fix bug where we can report GISelFailure on erased instructions

Ahmed Bougacha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 12:56:31 PDT 2017


ab added a comment.

I considered and dismissed speculatively printing:  it's a pretty expensive operation (especially when it needs to print an IR value, and it needs to recompute slot numbers).

Here's another idea I considered:  have legalizeInstr return the instruction it failed on, in a std::pair<LegalizeResult, MachineInstr*>.

In practice, the external users of the LegalizeHelper API shouldn't care about LegalizeResult: we either return UnableToLegalize, or we return a success value (Legalized/AlreadyLegal.  So we could simply return a MachineInstr*, which is nullptr if we succeeded.  It would be weird to read though, so we could go extra fancy and have an Error that either contains a MachineInstr*, or is Error::success().


Repository:
  rL LLVM

https://reviews.llvm.org/D31503





More information about the llvm-commits mailing list