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 {
167
167
168
168
// finally, drill down GEP instructions until we get the array
169
169
// 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)) {
171
172
while (GEPInstr->getOpcode () == llvm::Instruction::GetElementPtr) {
172
173
llvm::Value *OpArg = GEPInstr->getOperand (0 );
174
+ if (llvm::ConstantExpr *NewGEPInstr =
175
+ llvm::dyn_cast<llvm::ConstantExpr>(OpArg)) {
176
+ GEPInstr = NewGEPInstr;
177
+ continue ;
178
+ }
173
179
174
180
if (auto *GlobalVar = llvm::dyn_cast<llvm::GlobalVariable>(OpArg)) {
175
- llvm::Constant *initializer = GlobalVar->getInitializer ();
176
-
177
181
llvm::Type *ValTy = GlobalVar->getValueType ();
178
182
if (auto *ArrTy = llvm::dyn_cast<llvm::ArrayType>(ValTy)) {
179
183
llvm::Type *ElTy = ArrTy->getElementType ();
180
184
if (ElTy == Ty)
181
185
return nullptr ;
182
186
}
183
187
}
188
+ break ;
184
189
}
185
190
}
186
191
You can’t perform that action at this time.
0 commit comments