[PATCH] D144776: [X86][MC] Early bail out in emitREXPrefix, NFCI

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 25 05:42:43 PST 2023


skan marked 2 inline comments as done.
skan added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:1207
+  default:
+    llvm_unreachable("Unexpected form in emitREXPrefix!");
+  case X86II::RawFrmMemOffs:
----------------
pengfei wrote:
> skan wrote:
> > pengfei wrote:
> > > How about move the check here:
> > > ```
> > > if (HasRegOp)
> > >   llvm_unreachable("Unexpected form in emitREXPrefix!");
> > > ```
> > > Then you don't need the lambda expression.
> > I haven't got your idea. Lambda is used to check `HighByteReg`. How can we achieve the same effect with your code?
> Because you don't need to do the check and return twice with the change. Just do it in the end of the function.
Got it, will do


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144776



More information about the llvm-commits mailing list