[IR] Update llvm.prefetch to match docs
authorArchibald Elliott <archibald.elliott@arm.com>
Wed, 17 Aug 2022 17:05:12 +0000 (18:05 +0100)
committerArchibald Elliott <archibald.elliott@arm.com>
Fri, 19 Aug 2022 08:11:17 +0000 (09:11 +0100)
commit3a729069e463440035284ae6a27798b2573223de
tree9e76659f552a3f20a4209a8b7c47a4212ca6cee0
parent8b50ffe9fdc3cd457796857d3661e34490ef0490
[IR] Update llvm.prefetch to match docs

The current llvm.prefetch intrinsic docs state "The rw, locality and
cache type arguments must be constant integers."

This change:
- Makes arg 3 (cache type) an ImmArg
- Improves the verifier error messages to reference the incorrect
  argument.
- Fixes two tests which contradict the docs.

This is needed as the lowering to GlobalISel is different for ImmArgs
compared to other constants. The non-ImmArgs create a G_CONSTANT MIR
instruction, the for ImmArgs the constant is put directly on the
intrinsic's MIR instruction as an immediate.

Differential Revision: https://reviews.llvm.org/D132042
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/IR/Verifier.cpp
llvm/test/Assembler/auto_upgrade_intrinsics.ll
llvm/test/CodeGen/RISCV/prefetch.ll
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir