indirectbr implementation for Alpha backend

Hi,

I encountered an error while trying to use the indirectbr instruction with Alpha backend (current build). Here’s part of the code sequence that I tried to compile:

bb1:

%1 = load i32* %i, align 4
%2 = add nsw i32 %1, 1
store i32 %2, i32* %i, align 4
indirectbr i8* blockaddress(@main, %bb1), [ label %bb1 ]
br label %return

This compiles correctly when I use the X86 or PPC backend, but results in the following error with Alpha backend:

LLVM ERROR: Cannot select: 0x95a0490: i64 = BlockAddress<@main, %bb1> [ID=3]

I also found the following line commented out in the file lib/Target/Alpha/AlphaISelLowering.cpp:

// setOperationAction(ISD::BRIND, MVT::Other, Expand);

My guess is that indirectbr is not implemented for Alpha. If that’s the case, where do I need to make changes to implement this instruction?

Thank you,

Giang

Hi,
I encountered an error while trying to use the indirectbr instruction with
Alpha backend (current build). Here's part of the code sequence that I
tried to compile:
bb1:
%1 = load i32* %i, align 4
%2 = add nsw i32 %1, 1
store i32 %2, i32* %i, align 4
indirectbr i8* blockaddress(@main, %bb1), [ label %bb1 ]
br label %return
This compiles correctly when I use the X86 or PPC backend, but results in
the following error with Alpha backend:
LLVM ERROR: Cannot select: 0x95a0490: i64 = BlockAddress<@main, %bb1> [ID=3]
I also found the following line commented out in the file
lib/Target/Alpha/AlphaISelLowering.cpp:
// setOperationAction(ISD::BRIND, MVT::Other, Expand);
My guess is that indirectbr is not implemented for Alpha. If that's the
case, where do I need to make changes to implement this instruction?

What is missing is lowering block addresses to target addresses. Have
you tried uncommenting that line? Otherwise lowering directly to a
target address (if that expansion doesn't) may work.

Andrew