nikic added inline comments.

================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2338-2340
+    if (BinaryOperator *Idx =
+            dyn_cast_or_null<BinaryOperator>(GEP.getOperand(1)))
+      if ((Idx->getOpcode() == Instruction::Add) && Idx->hasOneUse()) {
----------------



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2346
+        //   %newgep = getelementptr i32, i32* %newptr, i64 %idx2
+        Value *Ptr = GEP.getOperand(0);
+        auto *NewPtr = GetElementPtrInst::Create(
----------------



================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2349
+            GEP.getResultElementType(), Ptr, Idx->getOperand(0), "", &GEP);
+        auto *NewGEP = GetElementPtrInst::Create(GEP.getResultElementType(),
+                                                 NewPtr, Idx->getOperand(1));
----------------
No need for the NewGEP variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155688/new/

https://reviews.llvm.org/D155688

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to