inkwell icon indicating copy to clipboard operation
inkwell copied to clipboard

Passing a non-empty name to builder.build_fence results in a verifier error.

Open bjorn3 opened this issue 2 years ago • 4 comments

Describe the Bug

Passing a non-empty name to builder.build_fence results in a verifier error:

Instruction has a name, but provides a void value!
  %fence = fence seq_cst

To Reproduce

builder.build_fence(AtomicOrdering::SequentiallyConsistent, 0, "fence");

Expected Behavior

Either it doesn't produce a verifier error or it is not possible to pass a name at all.

LLVM Version (please complete the following information):

  • LLVM Version: 7.0

Desktop (please complete the following information):

  • OS: Debian Buster

bjorn3 avatar Sep 26 '21 16:09 bjorn3

hmm not sure I totally follow. You're saying even though the API accepts a string, it isn't valid to provide one?

TheDan64 avatar Sep 30 '21 02:09 TheDan64

Or maybe the name is valid for certain orderings only?

TheDan64 avatar Sep 30 '21 02:09 TheDan64

hmm not sure I totally follow. You're saying even though the API accepts a string, it isn't valid to provide one?

It seems so.

bjorn3 avatar Sep 30 '21 08:09 bjorn3

This seems like a bug with the C API to me. The FenceInst constructor sets its type to void here

FenceInst::FenceInst( ... )
: Instruction(Type::getVoidTy(C), ...) { ... }

while the verifier explicitly checks that void typed values do not have a name here

Assert(!I.getType()->isVoidTy() || !I.hasName(),
       "Instruction has a name, but provides a void value!", &I);

pejato avatar Feb 20 '22 20:02 pejato