benchmark-subsetting / cere

CERE: Codelet Extractor and REplayer
https://benchmark-subsetting.github.io/cere/
GNU Lesser General Public License v3.0
41 stars 22 forks source link

Assertion failure with replay using LLVM 14 #205

Open sm-hwang opened 1 year ago

sm-hwang commented 1 year ago

While following the CERE tutorial sequentially with LLVM 14.0.0 release, I get this assertion failure at the replay stage.

opt: /home/steven/clang+llvm-14.0.0-aarch64-linux-gnu/include/llvm/IR/Instructions.h:962: static llvm::GetElementPtrInst* llvm::GetElementPtrInst::Create(llvm    ::Type*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&, llvm::Instruction*): Assertion `cast<PointerType>(Ptr->getType()->getScalarType()) ->isOpaqueOrPointeeTypeMatches(PointeeType)\' failed.

I am using the following example and makefile.

// test.c
#include <math.h>

const int large = 1000000;

__attribute__((noinline))double foo(int x) {
  double y = 0;
  for (int i = 1; i < sqrt(x); ++i) {
    y = log(i);
  }
  return y;
}

__attribute__((noinline))int main() {
  for (int i = large; i < 2 * large; ++i) {
    foo(i);
  }
}
CC = cerec
CLD = cerec

test: test.c
        $(CC) -c -gdwarf-4 -O1 test.c -o test.o
        $(CLD) -O1 -gdwarf-4 -v test.o -lm -o test

clean:
        rm -f *.o test

In detail, the sequence of commands I run are:

$ cere configure --build-cmd="make" --clean-cmd="make clean" --run-cmd="./test"
$ cere profile
$ cere regions
$ cere trace --region=__cere__test_foo_7
$ cere selectinv --region=__cere__test_foo_7
$ cere capture --region=__cere__test_foo_7
$ cere replay --region=__cere__test_foo_7 //error