[PATCH] D36069: [X86][InstCombine] Add some constant folding for BZHI intrinsics

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 00:23:44 PDT 2017


zvi accepted this revision.
zvi added a comment.
This revision is now accepted and ready to land.

LGTM with minor comments.



================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2281
+      unsigned BitWidth = II->getType()->getIntegerBitWidth();
+      if (Index >= BitWidth)
+        return replaceInstUsesWith(CI, II->getArgOperand(0));
----------------
Minor: this is not constant-folding - it's a simplification, so consider updating the comment.


================
Comment at: test/Transforms/InstCombine/X86/x86-bmi-tbm.ll:212
+;
+  %1 = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %a, i32 31)
+  ret i32 %1
----------------
This is out of scope, but would combining to 'and i32 %a, 0xefffffff' be profitable? It would at least be friendlier to DemandedBits.


https://reviews.llvm.org/D36069





More information about the llvm-commits mailing list