[PATCH] D128599: [RISCV] Teach RISCVMergeBaseOffset to handle read-modify-write of a global.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 12:53:18 PDT 2022


craig.topper added a comment.

In D128599#3613287 <https://reviews.llvm.org/D128599#3613287>, @asb wrote:

> I've not had a chance to delve in any further, but I'm getting a compilation failure with builtin-prefetch-2.c from the GCC torture suite when applying this patch:
>
>   clang-15: /home/asb/llvm-project/llvm/lib/CodeGen/LiveVariables.cpp:129: void llvm::LiveVariables::HandleVirtRegUse(llvm::Register, llvm::MachineBasicBlock *, llvm::MachineInstr &): Assertion `MRI->getVRegDef(Reg) && "Register use before def!"' failed.

The test contains an instruction that stores a pointer value to the location it points to

  SD %3:gpr, %3:gpr, 16 :: (store (s64) into `ptr getelementptr inbounds (%struct.S, ptr @str, i64 0, i32 4)`, !tbaa !10)

In the old code the DestReg != BaseAddrReg check combine with single use prevented this. Without the one use check DestReg != BaseAddrReg isn't strong enough by itself to catch this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128599



More information about the llvm-commits mailing list