This patch fixes machine verifier errors:
*** Bad machine code: Missing mayLoad flag *** - function: foo1 - basic block: %bb.0 (0x5560fc64ef08) - instruction: %4:float32regs = INT_PTX_LDG_GLOBAL_f32areg64 killed %3:int64regs :: (load (s32) from %ir.from1, addrspace 1)
LDG/LDU should not be treated as loads because they operates on
read-only memory, and therefore these instructions should not have mayLoad flag.
Machine verifier checks for memoperands to determine whether an instruction is
a load, so dropping them during lowering fixes the problem.
The function also handles regular loads/stores (e.g. NVPTXISD::LoadV4) and those should still mark the node as a memory reference.