mr-ma / composition-framework

1 stars 3 forks source link

Run fails with GEP is not of right type for indices for PreservedValueRegistry example. #2

Open dennisfischer opened 6 years ago

dennisfischer commented 6 years ago

The following code should illustrate how to use the preserved value registry

  auto arg1 = ConstantInt::get(Type::getInt32Ty(M.getContext()), static_cast<uint64_t>(1));
  auto arg2 = ConstantInt::get(Type::getInt32Ty(M.getContext()), static_cast<uint64_t>(2));
  PreservedValueRegistry::Register("comp-analysis",
                                   arg1,
                                   [this](const std::string &pass, llvm::Value *oldV, llvm::Value *newV) {
                                     //assert ( false );
                                   });
  arg1->replaceAllUsesWith(arg2);

However, if it is used then tetris example fails with this error.

GEP is not of right type for indices!
  %3 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32GEP is not of right type for indices!
  %5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32GEP is not of right type for indices!
  %11 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32GEP is not of right type for indices!
  %13 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32GEP is not of right type for indices!
  %19 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32GEP is not of right type for indices!
  %21 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
 i32LLVM ERROR: Broken function found, compilation aborted!