driver: keep -O2 loops for the i64-less target
Scripts/tms-clang runs the generic opt pipeline without a target machine, so the target cannot veto IndVarSimplify's exit-value replacement through TTI. That rewrite turns sumto's closed form into an i33 multiply, which llc cannot select. Disable only that rewrite with -replexitval=never and document why.
This commit is contained in:
1 parent
57ea80a5c0
commit
cfe751ccab
1 file changed
+9
-1
+9
-1
@@ -49,7 +49,15 @@ trap 'rm -rf "$TMP"' EXIT HUP INT TERM
|
||||
"$TMS_BITADDR" --scale "$TMP/step1.ll" "$TMP/scaled.ll" 2>/dev/null
|
||||
|
||||
if [ "$OPTIMIZE" -eq 1 ]; then
|
||||
"$TMS_OPT" -passes='default<O2>' -S "$TMP/scaled.ll" -o "$TMP/opt.ll"
|
||||
# This target has no i64 and no multiply-high, so IndVarSimplify's
|
||||
# exit-value replacement (which rewrites a loop's final value into a
|
||||
# closed-form i33 multiply, e.g. n*(n+1)/2 for sumto) produces IR that
|
||||
# llc cannot select. -replexitval is an option of IndVarSimplify; disabling
|
||||
# only that rewrite keeps the loop, which is what ordinary -O2 code needs.
|
||||
# This is a driver policy, not a target TTI policy: opt runs without a
|
||||
# target machine here.
|
||||
"$TMS_OPT" -passes='default<O2>' -replexitval=never -S "$TMP/scaled.ll" \
|
||||
-o "$TMP/opt.ll"
|
||||
NORMALIZE_IN="$TMP/opt.ll"
|
||||
else
|
||||
NORMALIZE_IN="$TMP/scaled.ll"
|
||||
|
||||
Reference in new issue
Block a user