[LLVMdev] "two address instruction invalid" assertion in TwoAddressInstructionPass

Peng Cheng gm4cheng at gmail.com
Mon May 18 13:06:32 PDT 2015


Here is a simple llvm ir at the end.  When I ran "lli -O0" on it, I got:

lli: .../TwoAddressInstructionPass.cpp:1314: bool
{anonymous}::TwoAddressInstructionPass::collectTiedOperands(llvm::MachineInstr*,
{anonymous}::TwoAddressInstructionPass::TiedOperandMap&): Assertion `SrcReg
&& SrcMO.isUse() && "two address instruction invalid"' failed.

Is this an IR issue or bug somewhere?

Thanks,
-Peng


---- <begin> ----
; ModuleID = 'module_name'

%0 = type <{ double*, i1* }>

define void @main(double*, %0* %t0) {
entry:
  br label %1

; <label>:1                                       ; preds = %entry
  %2 = getelementptr inbounds %0* %t0, i64 0, i32 1
  %3 = load i1** %2, align 8
  %4 = load i1* %3, align 1
  %5 = getelementptr inbounds %0* %t0, i64 0, i32 0
  %6 = load double** %5, align 8
  %7 = load double* %6, align 8
  %8 = fcmp ogt double %7, -1.000000e-01
  %9 = select i1 %8, double 1.000000e+00, double 0.000000e+00
  %10 = select i1 %4, double %9, double 1.000000e+00
  store double %10, double* %0, align 8
  ret void
}

---- <end> ----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150518/0220b5d2/attachment.html>


More information about the llvm-dev mailing list