[PATCH] D103861: [Attributor] Look through selects in genericValueTraversal

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 18:18:18 PDT 2021


baziotis added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:310
+        continue;
+      if (auto *CI = dyn_cast_or_null<ConstantInt>(*C)) {
+        if (CI->isZero())
----------------
Not important but `SI->getCondition()` should return either an `i1` or a vector of `i1`. I don't know what's happening in `getAssumedConstant()` but I assume it doesn't deal with vectors which means that if `C.hasValue()` and it is //not// `undef`, then it //must// be a `ConstantInt`? So, maybe put that in an `assert()`. OTOH, if later you decide to deal with vectors, those asserts will fire while in this you can just add an `else if`. Anyway, just wanted to bring it to the foreground and you can choose what is better.


================
Comment at: llvm/test/Transforms/Attributor/lvi-for-ashr.ll:45
+; IS__TUNIT_NPM:       bb_then:
+; IS__TUNIT_NPM-NEXT:    [[DOT:%.*]] = select i1 true, i32 3, i32 2
+; IS__TUNIT_NPM-NEXT:    br label [[RETURN]]
----------------
Why is this not replaced by 3 now?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103861



More information about the llvm-commits mailing list