[PATCH] D122081: Add DXILPrepare CodeGen pass

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 16:03:54 PDT 2022


beanz added inline comments.


================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:64
+  }
+#include "llvm/IR/Attributes.inc"
+      for (auto &BB : F) {
----------------
nikic wrote:
> Do you really need Attributes.inc here? You should be able to loop over all attributes using Attribute::None and Attribute::EndAttrKind.
I don't strictly need it, but if `isValidForDXIL` gets called with a constant it should get constant-folded to true/false. That isn't the case if I call it in a loop.


================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:75
+          Value *In = I->getOperand(0);
+          Value *Zero = ConstantFP::get(In->getType(), 0.0);
+          I->replaceAllUsesWith(Builder.CreateFSub(Zero, In));
----------------
nikic wrote:
> Shouldn't this be negative zero?
Yep, you are 100% correct. Will update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122081



More information about the llvm-commits mailing list