File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -167,20 +167,25 @@ class DXILPrepareModule : public ModulePass {
167167
168168 // finally, drill down GEP instructions until we get the array
169169 // that is being accessed, and compare element types
170- if (auto *GEPInstr = llvm::dyn_cast<llvm::ConstantExpr>(Operand)) {
170+ if (llvm::ConstantExpr *GEPInstr =
171+ llvm::dyn_cast<llvm::ConstantExpr>(Operand)) {
171172 while (GEPInstr->getOpcode () == llvm::Instruction::GetElementPtr) {
172173 llvm::Value *OpArg = GEPInstr->getOperand (0 );
174+ if (llvm::ConstantExpr *NewGEPInstr =
175+ llvm::dyn_cast<llvm::ConstantExpr>(OpArg)) {
176+ GEPInstr = NewGEPInstr;
177+ continue ;
178+ }
173179
174180 if (auto *GlobalVar = llvm::dyn_cast<llvm::GlobalVariable>(OpArg)) {
175- llvm::Constant *initializer = GlobalVar->getInitializer ();
176-
177181 llvm::Type *ValTy = GlobalVar->getValueType ();
178182 if (auto *ArrTy = llvm::dyn_cast<llvm::ArrayType>(ValTy)) {
179183 llvm::Type *ElTy = ArrTy->getElementType ();
180184 if (ElTy == Ty)
181185 return nullptr ;
182186 }
183187 }
188+ break ;
184189 }
185190 }
186191
You can’t perform that action at this time.
0 commit comments