[PATCH] D124894: Avoid 8 and 16bit switch conditions on x86

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 13:55:15 PDT 2022


MatzeB marked an inline comment as done.
MatzeB added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringBase.cpp:1607
+TargetLoweringBase::shouldExtendSwitch(const SwitchInst &SI,
+                                       Instruction::CastOps *ExtOp) const {
+  Value *Cond = SI.getCondition();
----------------
craig.topper wrote:
> I think we would typically pass ExtOp by reference so you can't pass null.
> I think we would typically pass ExtOp by reference so you can't pass null.

No longer relevant as the parameter is gone now, but FWIW:

I prefer pointers for "out parameters" because that makes it clearer when readining the calling code that there is an "out parameter".

i.e. `foobar(&baz)` has a clear signal that baz is probably an "out parameter", for `foobar(baz)` it's easy to miss this when `baz` happens to be a writable reference.

I find that more valuable than having an assurance that nobody passes `nullptr`...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124894



More information about the llvm-commits mailing list