[llvm] [VectorCombine] Enable transform 'scalarizeLoadExtract' for non constant indexes (PR #65445)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 22:34:38 PDT 2023


================
@@ -1196,9 +1200,14 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
   // Replace extracts with narrow scalar loads.
   for (User *U : LI->users()) {
     auto *EI = cast<ExtractElementInst>(U);
-    Builder.SetInsertPoint(EI);
-
     Value *Idx = EI->getOperand(1);
+
+    // Insert 'freeze' for poison indexes.
+    DenseMap<ExtractElementInst *, ScalarizationResult>::iterator It;
----------------
nikic wrote:

`auto It = NeedFreeze.find(EI)`. Not need to spell out the iterator type, and I'm not sure why you did the assignment inside the if.

https://github.com/llvm/llvm-project/pull/65445


More information about the llvm-commits mailing list