Hi,
For LLVM IR lshr
, it’s documented (LLVM Language Reference Manual — LLVM 16.0.0git documentation) that " Both arguments to the ‘lshr
’ instruction must be the same integer or vector of integer type."
With <result> = lshr <ty> <op1>, <op2> ; yields ty:result
, my interpretation is that
- if
op1
is integer,op2
must be integer (of the same type) - if
op2
is vector of integer,op2
must be vector of integer (with the same integer type).
If this is guaranteed in code (more than doc), using pattern matchers are much easier for my use case (where op1
is known to be a vector already, so I could assume op2
is a vector and not worry about scalar for whatever reason).
I wonder how (where) this is enforced?
- Verifier.cpp verifies return type is the same as
op1
type and return type is integer (llvm-project/Verifier.cpp at 27d666b9adc12a13f67ccde96d5b4d181f56ffc5 · llvm/llvm-project · GitHub), but doesn’t seem to verifyop1
andop2
are either both vector or both scalar.
Please advise what i miss, thanks!