Issue 97533
Summary Assertion failure in TwoAddressInstructionPass
Labels backend:X86, llvm:crash
Assignees
Reporter nikic
    ```llvm
; RUN: llc < %s
target triple = "x86_64-unknown-linux-gnu"

define ptr @test(ptr %ptr, i8 %arg, i1 %cond) {
entry:
  br i1 %cond, label %if, label %exit

if:
  %idx = zext i8 %arg to i64
  %gep1 = getelementptr ptr, ptr %ptr, i64 %idx
  %ptr2 = load ptr, ptr %gep1, align 8
  %gep2 = getelementptr i64, ptr %ptr2, i64 %idx
  br label %exit

exit:
  %phi = phi ptr [ %gep2, %if ], [ null, %entry ]
 ret ptr %phi
}
```

Results in:
```
llc: /home/npopov/repos/llvm-project/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1461: bool (anonymous namespace)::TwoAddressInstructionPass::collectTiedOperands(MachineInstr *, TiedOperandMap &): Assertion `SrcReg && SrcMO.isUse() && "two address instruction invalid"' failed.
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to