[PATCH] D35579: [SimplifyCFG] Generate lookup tables based on a function attribute

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 15:22:22 PDT 2017


joerg added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5155
+  Function *Fn = SI->getParent()->getParent();
+  StringRef FuncName = Fn->getName();
+  // Only build lookup table when we have a target that supports it or the
----------------
Just use Fn->getName() below directly.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5157
+  // Only build lookup table when we have a target that supports it or the
+  // attribute "no-lookup-table" is not set.
+  if (!TTI.shouldBuildLookupTables() ||
----------------
...and the attribute "..." is not set.


================
Comment at: test/Transforms/SimplifyCFG/Hexagon/disable-lookup-table.ll:60
+
+attributes #0 = { noinline nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-lookup-tables"="true" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="-hvx-double,-long-calls" "unsafe-fp-math"="false" "use-soft-float"="false" }
----------------
Can you reduce this further?


================
Comment at: test/Transforms/SimplifyCFG/disable-lookup-table.ll:29
+}
+
----------------
Since this is a bit fragile when it comes to other optimizations deciding to merge the ranges, can you test the reverse as well? I.e. that it is turned into a lookup table when just the attribute is missing.


https://reviews.llvm.org/D35579





More information about the llvm-commits mailing list