[PATCH] D150864: [AggressiveInstCombine] Handle the nested GEP/BitCast scenario in Load Merge.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 11:43:43 PDT 2023


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:796
   Instruction *Inst = dyn_cast<Instruction>(LI1->getPointerOperand());
+  if (Inst && (isa<BitCastInst>((Inst)->getOperand(0)) || isa<GetElementPtrInst>((Inst)->getOperand(0))))
+    return false;
----------------
Are bitcasts and GEPs the only possibilities here?  stripAndAccumulateConstantOffsets can also handle addrspacecast and call instructions (and maybe other things in the future).


================
Comment at: llvm/test/Transforms/AggressiveInstCombine/AArch64/or-load.ll:2178
+  ; Don't move gep2_cast before gep2
+  %gep2_cast = bitcast i8* %gep2 to i32*
+  %ld2 = load i32, i32* %gep2_cast, align 4
----------------
xbolva00 wrote:
> Typed pointers are gone, probably no new tests or fixes for them are allowed now.
> 
> @nikic ?
It isn't testing anything meaningful the way it's written, anyway; the pointer types are converted to "ptr" by the IR parser.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150864



More information about the llvm-commits mailing list